Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. stock BanPlayer(playerid, giveplayerid, time, reason[])
  2. {
  3. new name[24], namegive[24];
  4. if(playerid == 501) format(name, sizeof(name), "Squidward (Anti-Cheat)");
  5. else GetPlayerName(playerid, name, sizeof(name));
  6. GetPlayerName(giveplayerid, namegive, sizeof(namegive));
  7. new curtime = gettime();
  8. new expire;
  9. if(!time)
  10. {
  11. expire = 1577836800;
  12. }
  13. else
  14. {
  15. new Float:banminutes = time * 24 * 60 * 60;
  16. new bantime = floatround(banminutes);
  17. expire = curtime + bantime;
  18. }
  19. new q[400];
  20. new ip[16];
  21. GetPlayerIp(giveplayerid, ip, sizeof(ip));
  22. //AddBan(ip);
  23. format(q, sizeof(q), "INSERT INTO bans (name, reason, ban_time, issue_time, expiry_time, admin, ip) VALUES ('%s', '%s', %d, %d, %d, '%s', '%s')", namegive, reason, time, curtime, expire, name, ip);
  24. mysql_query(q, THREAD_INSERT_BAN);
  25. new banid = mysql_insert_id();
  26. new string[128];
  27. if(time)
  28. format(STRING, "AdmCmd: %s was banned for %d days by %s: %s", GetPlayerNameEx(giveplayerid), time, GetPlayerNameEx(playerid), reason);
  29. else
  30. format(STRING, "AdmCmd: %s was banned permanently by %s: %s", GetPlayerNameEx(giveplayerid), name, reason);
  31. SendClientMessageToAllEx(COLOR_LIGHTRED, string);
  32. if(time)
  33. format(STRING, "You were banned by Admin %s for %d days: %s", GetPlayerNameEx(playerid), time, reason);
  34. else
  35. format(STRING, "You were banned permanently by Admin %s: %s", name, reason);
  36. SendClientMessage(giveplayerid, 0x00FF00FF, string);
  37. new dialogstring[512];
  38. format(dialogstring, sizeof(dialogstring), "You have been banned from this server for the following reason:\n\n%s\n\nIf you think that this ban was in error, please go to http://cs-roleplay.indonesianforum.net and appeal it.\nYou will need the following info to appeal the ban:\n\nBan ID: %d\nAdmin that banned you: %s\nReason of the ban: %s\n\n{00ff00}PLEASE TAKE A SCREENSHOT USING F8 RIGHT NOW, AND INCLUDE IT IN YOUR BAN APPEAL!", reason, banid, name, reason);
  39. ShowPlayerDialog(giveplayerid, 4564, DIALOG_STYLE_MSGBOX, "Banned!", dialogstring, "Close", "");
  40. SetTimerEx("SendToKick", 1500, 0, "i", giveplayerid);
  41. return 1;
  42. }
  43.  
  44. stock BanAccount(playerid, giveplayerid[24], time, reason[], ip[])
  45. {
  46. new name[24];
  47. if(playerid == 501) format(name, sizeof(name), "Squidward (Anti-Cheat)");
  48. else GetPlayerName(playerid, name, sizeof(name));
  49. new curtime = gettime();
  50. new expire;
  51. if(!time)
  52. {
  53. expire = 1577836800;
  54. }
  55. else
  56. {
  57. new Float:banminutes = time * 24 * 60 * 60;
  58. new bantime = floatround(banminutes);
  59. expire = curtime + bantime;
  60. }
  61. new q[400];
  62. format(q, sizeof(q), "INSERT INTO bans (name, reason, ban_time, issue_time, expiry_time, admin, ip) VALUES ('%s', '%s', %d, %d, %d, '%s', '%s')", giveplayerid, reason, time, curtime, expire, name, ip);
  63. mysql_query(q, THREAD_INSERT_BAN);
  64. new string[128];
  65. if(time)
  66. format(string,sizeof(string), "AdmCmd: %s was offline banned for %d days by %s: %s", giveplayerid, time, GetPlayerNameEx(playerid), reason);
  67. else
  68. format(string,sizeof(string), "AdmCmd: %s was offline banned permanently by %s: %s", giveplayerid, name, reason);
  69. ABroadCast(COLOR_LIGHTRED, string, 2);
  70. return 1;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement