Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. }
  2. CMD:banday(playerid, params[])
  3. {
  4. new name[MAX_PLAYER_NAME];
  5. if(PlayerInfo[playerid][pAdmin] >= 3)
  6. {
  7. new giveplayerid,days,reason[128],string[128],giveplayer[25];
  8. if(sscanf(params, "uds[128]", giveplayerid,days,reason)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Syntax: /banday <Name/Playerid> <day> <Reason>");
  9. if(IsPlayerConnected(giveplayerid))
  10. {
  11. if(days <= 0 || days > 1000) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Invalid Day! (1-1000)");
  12. GetPlayerName(playerid, name, sizeof name);
  13. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  14. new year,month,day;
  15. getdate(year, month, day);
  16. day += days;
  17. if (IsMonth31(month))
  18. {
  19. if (day > 31)
  20. {
  21. month += 1;
  22. if (month > 12)
  23. {
  24. year += 1;
  25. while(day > 31) day -= 31;
  26. }
  27. else while(day > 31) day -= 31;
  28. }
  29. }
  30. else if (!IsMonth31(month))
  31. {
  32. if (day > 30)
  33. {
  34. month += 1;
  35. if (month > 12)
  36. {
  37. year += 1;
  38. while(day > 30) day -= 30;
  39. }
  40. else while(day > 30) day -= 30;
  41. }
  42. }
  43. else if (!IsMonth31(month) && IsMonth29(year) && month == 2)
  44. {
  45. if (day > 29)
  46. {
  47. month += 1;
  48. if (month > 12)
  49. {
  50. year += 1;
  51. while(day > 29) day -= 29;
  52. }
  53. else while(day > 29) day -= 29;
  54. }
  55. }
  56. else if (!IsMonth31(month) && !IsMonth29(year) && month == 2)
  57. {
  58. if (day > 28)
  59. {
  60. month += 1;
  61. if (month > 12)
  62. {
  63. year += 1;
  64. while(day > 28) day -= 28;
  65. }
  66. else while(day > 28) day -= 28;
  67. }
  68. }
  69. PlayerInfo[giveplayerid][pBTemp] = 1;
  70. PlayerInfo[giveplayerid][pBYear] = year;
  71. PlayerInfo[giveplayerid][pBMonth] = month;
  72. PlayerInfo[giveplayerid][pBDay] = day;
  73. strmid(PlayerInfo[giveplayerid][pBBy], name, 0, strlen(name), 255);
  74. strmid(PlayerInfo[giveplayerid][pBReason], reason, 0, strlen(reason), 255);
  75. Update(giveplayerid,pBTempx);
  76. Update(giveplayerid,pBYearx);
  77. Update(giveplayerid,pBMonthx);
  78. Update(giveplayerid,pBDayx);
  79. Update(giveplayerid,pBByx);
  80. Update(giveplayerid,pBReasonx);
  81. if(days == 1)
  82. {
  83. format(string,128,"AdmCmd: %s was banned by %s for %d day, reason: %s",giveplayer,name,days,reason);
  84. SendClientMessageToAll(COLOR_LIGHTRED,string);
  85. }
  86. else if(days > 1)
  87. {
  88. format(string,128,"AdmCmd: %s was banned by %s for %d days, reason: %s",giveplayer,name,days,reason);
  89. SendClientMessageToAll(COLOR_LIGHTRED,string);
  90. }
  91. new ip[25];
  92. GetPlayerIp(giveplayerid, ip, sizeof(ip));
  93. Banlog(ip,PlayerInfo[giveplayerid][pSQLID],PlayerInfo[playerid][pSQLID],reason,days);
  94. KickEx(giveplayerid);
  95. }
  96. else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Atentie: Acest player nu e conectat.");
  97. }
  98. else return SendClientMessage(playerid,COLOR_WHITE,AdminOnly);
  99. return true;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement