Advertisement
LVPYassine

Untitled

Jan 14th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. CMD:setdblevel(playerid, params[])
  2. {
  3. new account[24], Query[300], bString[128], level, Cache:GetCache;
  4. if(pData[playerid][Admin] == 10)
  5. {
  6. if(sscanf(params, "s[24]i", account,level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /Setdblevel [Account] [Level]");
  7. if(strlen(account) > 24) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player name cannot exceed 24 characters!");
  8. if(level > 10) return SendClientMessage(playerid,red,"ERROR: Invalid Level");
  9. format(Query, sizeof(Query), "SELECT `Username` FROM `players` WHERE `Username` = '%s' LIMIT 1", account);
  10. mysql_query(Query);
  11. if(cache_get_row_count() == 1)
  12. {
  13. format(Query, sizeof(Query), "UPDATE `players` SET Admin=%d WHERE `user` = '%s'", level, account);
  14. GetCache = mysql_query(Query);
  15. format(bString, sizeof(bString), "* You have succesfully set %s's level to %d.", account, level);
  16. SendClientMessage(playerid, -1, bString);
  17. }
  18. else
  19. {
  20. format(bString, sizeof(bString), "ERROR: Name %s doesn't exists in the database!", account);
  21. return SendClientMessage(playerid, red, bString);
  22. }
  23. cache_delete(GetCache);
  24. }
  25. else return SendClientMessage(playerid, yellow, "Sorry, you are not high enough level to use this command.");
  26. return 1;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement