Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. if(strcmp(cmd, "/offmakeadmin", true) == 0)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. if(PlayerInfo[playerid][pAdmin] > 5)
  6. {
  7. new length = strlen(cmdtext);
  8. while ((idx < length) && (cmdtext[idx] <= ' '))
  9. {
  10. idx++;
  11. }
  12. new offset = idx;
  13. new result[128];
  14. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  15. {
  16. result[idx - offset] = cmdtext[idx];
  17. idx++;
  18. }
  19. result[idx - offset] = EOS;
  20. if(!strlen(result))
  21. {
  22. SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /offmakeadmin [NUMELE-EXACT]");
  23. return 1;
  24. }
  25. new Query[256];
  26. format(Query, sizeof(Query), "SELECT `username` FROM `players` WHERE username = '%s' AND Admin > 0 LIMIT 1", (result));
  27. mysql_query(string);
  28. mysql_store_result();
  29. if(!mysql_num_rows())
  30. {
  31. format(string, sizeof(string), "Nu este nimeni cu numele %s inregistrat/cu admin!", (result));
  32. mysql_free_result();
  33. return SendClientMessage(playerid, 0xEF5C5CFF, string);
  34. }
  35. else if(mysql_num_rows() != 0)
  36. {
  37. format(Query, sizeof(Query), "UPDATE `players` SET `Admin` = 0 WHERE username = '%s'", (result));
  38. mysql_query(string);
  39. mysql_store_result();
  40. format(string, sizeof(string), "{0066FF}[Info:] {FFFFFF}%s nu mai este admin!", (result));
  41. ABroadCast(0xa9c4e4FF, string, 1);
  42. mysql_free_result();
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement