Hello.
He was engaged in this topic not so long ago.
Firstly, you have not specified what plugin you use for the rights.
Personally, I'm for this type prefer to use LuckyPerms. It is for this purpose more suitable.
Of his cons - no ability to edit the file in PermissionEX. In any case, you need a DB connection. It is possible for the database in the file (so the default) and MySQL (Our option).
After connecting to database, reboot the server. MySQL will automatically appear in the right table. On the complete configuration of this plugin very a lot of articles on the Internet.
Then you get the data from the form. For this purpose it is preferable to use AJAX.
Your
main file and shape:
var nickname = document.getElementById(" ID of the input field nick ").value;
var permission = document.getElementById(" ID of the input field privileges ").value;
$.get('get_donate.php', {nick: nickname, perm: permission}).done(function(data)) {
if (data=="ok") {
alert("Payment successful");
} else {
alert("an error Occurred");
}
});
File
get_donate.php:
$nick = $_GET['nick'];
$perm = $_GET['perm'];
// Here you get the user's balance
if ($balance >= /* Value */) {
// Make the purchase
// Write off balance
// Give the privilege
echo 'ok';
} else {
echo 'error';
}
Explain a little more about the issue of privilege. All user privileges are stored in a separate MySQL table.
The structure of the table (names are approximate, can't remember exactly):
- UserID - UserName - Parent -
UserName - the player's name, always lowercase. I.e. if the user's nick UsER123, in this table it will be recorded as user123. I hope it is clear.
And, since all the privileges are stored in one table, you can change the privileges of a regular UPDATE query.
If something is not clear - write. I will try to answer all your questions.
I think the best solution will be crowns. Every day, for example, in 12 days, Kron will take place for all users.
When the original results, you need to write the date when the donation is withdrawn. The script called Kron will see today at that time and date to set the privilege on default. - toni_Corkery commented on April 18th 20 at 13:23