Guest User

Untitled

a guest
May 24th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. if(strcmp(cmd, "/bot", true) == 0)
  2. {
  3. new botcmd;
  4. tmp = strtok(cmdtext, idx);
  5. if(!IsPlayerAdmin(playerid))
  6. {
  7. SendClientMessage(playerid, COLOR_BRIGHTRED, "Admins Only!");
  8. return 1;
  9. }
  10. if(!strlen(tmp)) {
  11. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [name/age/say/raw/toggle]");
  12. return 1;
  13. }
  14.  
  15. if(strcmp(tmp, "name", true)==0)
  16. botcmd = 1;
  17. else if(strcmp(tmp, "say", true)==0)
  18. botcmd = 2;
  19. else if(strcmp(tmp, "raw", true)==0)
  20. botcmd = 3;
  21. else if(strcmp(tmp, "toggle", true)==0)
  22. botcmd = 4;
  23. else if(strcmp(tmp, "age", true)==0)
  24. botcmd = 5;
  25.  
  26. tmp = strtok(cmdtext, idx);
  27. if(botcmd < 6 && !strlen(tmp)) {
  28. if(botcmd==0)
  29. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [name/say/raw/toggle]");
  30. else if(botcmd==1)
  31. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [name] [name]");
  32. else if(botcmd==2)
  33. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [say] [msg]");
  34. else if(botcmd==3)
  35. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [raw] [raw data]");
  36. else if(botcmd==4)
  37. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [toggle] [on | off]");
  38. else if(botcmd==5)
  39. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bot [age] [age]");
  40. return 1;
  41. }
  42.  
  43.  
  44. if(botcmd==1)//Bot Name
  45. {
  46. if(BotOn == 0)
  47. {
  48. SendClientMessage(playerid, COLOR_WHITE, "The Bot is turned off so you cannot use this CMD.");
  49. return 1;
  50. }
  51. new Thing[200], Name[MAX_PLAYER_NAME];
  52. GetPlayerName(playerid, Name, sizeof(Name));
  53. format(Thing, sizeof(Thing), "%s has changed the servers bot name from %s to %s", Name, BotName, tmp);
  54. SendClientMessageToAll(COLOR_YELLOW, Thing);
  55. format(BotName, sizeof(BotName), "%s", tmp);
  56. return 1;
  57. } else if (botcmd==2)//Bot say
  58. {
  59. if(BotOn == 0)
  60. {
  61. SendClientMessage(playerid, COLOR_WHITE, "The Bot is turned off so you cannot use this CMD.");
  62. return 1;
  63. }
  64. SendBotMsg(playerid, cmdtext[9]);
  65. return 1;
  66. } else if (botcmd==3)//Bot raw
  67. {
  68. if(BotOn == 0)
  69. {
  70. SendClientMessage(playerid, COLOR_WHITE, "The Bot is turned off so you cannot use this CMD.");
  71. return 1;
  72. }
  73. SendBotRaw(playerid, cmdtext[9]);
  74. return 1;
  75. } else if (botcmd==4)//Bot toggle
  76. {
  77. if(strcmp(tmp, "on", true) == 0)
  78. {
  79. if(BotOn == 1)
  80. {
  81. SendClientMessage(playerid, COLOR_YELLOW, "The Bot is already switched on");
  82. }
  83. else
  84. {
  85. BotOn = 1;
  86. SendClientMessageToAll(COLOR_YELLOW, "The servers bot has been switched on!");
  87. }
  88. } else if(strcmp(tmp, "off", true) == 0)
  89. {
  90. if(BotOn == 0)
  91. {
  92. SendClientMessage(playerid, COLOR_YELLOW, "The Bot is already switched off");
  93. }
  94. else
  95. {
  96. BotOn = 0;
  97. SendClientMessageToAll(COLOR_YELLOW, "The servers bot has been switched Off!");
  98. }
  99. }
  100. } else if (botcmd==5)//Bot age
  101. {
  102. if(BotOn == 0)
  103. {
  104. SendClientMessage(playerid, COLOR_WHITE, "The Bot is turned off so you cannot use this CMD.");
  105. return 1;
  106. }
  107. new Thing[200], Name[MAX_PLAYER_NAME];
  108. new AGE;
  109. AGE = strval(tmp);
  110. GetPlayerName(playerid, Name, sizeof(Name));
  111. format(Thing, sizeof(Thing), "%s has changed the bots age from %s to %d", Name, BotAge, AGE);
  112. SendClientMessageToAll(COLOR_YELLOW, Thing);
  113. format(BotAge, sizeof(BotAge), "%d", AGE);
  114. return 1;
  115. }
  116. return 1;
  117. }
Add Comment
Please, Sign In to add comment