Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- task checkForDonations[20000]()
- {
- mysql_tquery(gSQL, "SELECT * FROM `donations` WHERE `received` = '0' AND `completed` = '1'", "checkDonations", "");
- return true;
- }
- function checkDonations()
- {
- if(!cache_num_rows())
- return true;
- for(new i = 0, j = cache_num_rows(); i != j; ++i)
- {
- gQuery[0] = (EOS);
- mysql_format(gSQL, gQuery, sizeof gQuery, "UPDATE `donations` SET `received` = '1' WHERE `id` = '%d'", cache_get_field_content_int(i, "id"));
- mysql_tquery(gSQL, gQuery, "", "");
- gQuery[0] = (EOS);
- mysql_format(gSQL, gQuery, sizeof gQuery, "UPDATE `users` SET `GoldPoints` = `GoldPoints` + '%d' WHERE `id` = '%d' LIMIT 1", cache_get_field_content_int(i, "amount"), cache_get_field_content_int(i, "userid"));
- mysql_tquery(gSQL, gQuery, "giveDonation", "dd", cache_get_field_content_int(i, "userid"), cache_get_field_content_int(i, "amount"), cache_get_field_content_int(i, "id"));
- }
- return true;
- }
- function giveDonation(userid, amount, donationid)
- {
- new name;
- cache_get_field_content(0, "name", name);
- gString[0] = (EOS);
- format(gString, sizeof gString, "(Donation): %s [db:%d] has received %d premium points from a donation [donation:%d].", name, userid, amount, donationid);
- SendAdminMessage(COLOR_LOGS, gString, 5);
- foreach(new x : Player)
- {
- if(PlayerInfo[x][pSQLID] == userid)
- {
- SCMex(x, COLOR_GREEN, "Ai primit %d premium points de la donatia cu numarul %d.", amount, donationid);
- PlayerInfo[x][pPremiumPoints] += amount;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement