Oblivion_UFF

this

Oct 11th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. CMD:announce(playerid, params[])
  2. {
  3. if(Pinfo[playerid][Padmin] < 7)
  4. return SendClientMessage(playerid, -1, "Insufficient permissions!");
  5. new tmp[300], str[300];
  6. if(sscanf(params, "s", tmp))
  7. {
  8. SendClientMessage(playerid, -1, "/announce <msg>");
  9. return true;
  10. }
  11. // Check for special trouble-making input
  12. if(strfind(tmp, "~x~", true) != -1)
  13. return SendClientMessage(playerid, -1, "~x~ is not allowed in announce.");
  14. if(strfind(tmp, "#k~", true) != -1)
  15. return SendClientMessage(playerid, -1, "The constant key is not allowed in announce.");
  16. if(strfind(params, "/q", true) != -1)
  17. return SendClientMessage(playerid, -1, "You are not allowed to type /q in announcement!");
  18. // Count tildes (uneven number = faulty input)
  19. iTemp = 0;
  20. for(new i = (strlen(tmp)-1); i != -1; i--)
  21. {
  22. if(tmp[i] == '~')
  23. iTemp ++;
  24. }
  25. if(iTemp % 2 == 1)
  26. return SendClientMessage(playerid, -1, "You either have an extra ~ or one is missing in the announcement!");
  27.  
  28. if(Pinfo[playerid][Padmin] < 7)
  29. {
  30. if(GetPVarInt(playerid, "UsedAnn") == 1)
  31. {
  32. SendClientMessage(playerid, -1, "Admins can only make 1 announcement per 5 minutes, sorry!");
  33. return true;
  34. }
  35. SetPVarInt(playerid, "UsedAnn", 1);
  36. SetTimerEx("ResetAnn", 300000, false, "i", playerid);
  37. }
  38. format(str, sizeof(str), "~w~%s", tmp);
  39. GameTextForAll(str, 6500, 3);
  40. return true;
  41. }
  42. forward ResetAnn(playerid);
  43. public ResetAnn(playerid)
  44. {
  45. if(IsPlayerConnected(playerid)) DeletePVar(playerid, "UsedAnn");
  46. }
Add Comment
Please, Sign In to add comment