Advertisement
glitchdetector

Untitled

Sep 7th, 2011
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. public OnPlayerCommandText(playerid, cmdtext[])
  2. {
  3. new cmd[256];
  4. new tmp[256];
  5. new idx;
  6. if(IsPlayerAdmin(playerid)){ //START_ADMIN
  7.  
  8. //RESTART_GAME
  9. if(strcmp("/newgame", cmdtext, true) == 0)
  10. {
  11. new i;
  12. for(i=0;i<MAX_VEHICLES;i++){
  13. if(GetVehicleModel(i)==451){
  14. DestroyVehicle(i);
  15. }
  16. if(GetVehicleModel(i)==596){
  17. DestroyVehicle(i);
  18. }
  19. if(GetVehicleModel(i)==427){
  20. DestroyVehicle(i);
  21. }
  22. }
  23. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
  24. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_robbers1.txt");
  25. SendClientMessageToAll(COLOR_BLUE,"[NEW GAME]: A new game is about to start.");
  26. for(i=0;i<MAX_PLAYERS;i++){
  27. ForceClassSelection(i);
  28. SetPlayerHealth(i,0);
  29. return 1;
  30. }
  31. SendClientMessageToAll(COLOR_BLUE,"[NEW GAME]: A new game has started.");
  32. }
  33.  
  34. //NEW_ROUND
  35. if(strcmp("/newround", cmdtext, true) == 0)
  36. {
  37. new i;
  38. for(i=0;i<MAX_VEHICLES;i++){
  39. if(GetVehicleModel(i)==451){
  40. DestroyVehicle(i);
  41. }
  42. if(GetVehicleModel(i)==596){
  43. DestroyVehicle(i);
  44. }
  45. if(GetVehicleModel(i)==427){
  46. DestroyVehicle(i);
  47. }
  48. }
  49. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
  50. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_robbers1.txt");
  51. SendClientMessageToAll(COLOR_BLUE,"[NEW ROUND]: A new round is about to start.");
  52. for(i=0;i<MAX_PLAYERS;i++){
  53. SetPlayerHealth(i,0);
  54. }
  55. SendClientMessageToAll(COLOR_BLUE,"[NEW ROUND]: A new round has started.");
  56. return 1;
  57. }
  58.  
  59. //TEAM_SWAP
  60. if(strcmp("/teamswap", cmdtext, true) == 0)
  61. {
  62. new i;
  63. for(i=0;i<MAX_VEHICLES;i++){
  64. if(GetVehicleModel(i)==451){
  65. DestroyVehicle(i);
  66. }
  67. if(GetVehicleModel(i)==596){
  68. DestroyVehicle(i);
  69. }
  70. if(GetVehicleModel(i)==427){
  71. DestroyVehicle(i);
  72. }
  73. }
  74. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
  75. total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_robbers1.txt");
  76. SendClientMessageToAll(COLOR_BLUE,"[TEAM SWAP]: Teams are getting swapped.");
  77. for(i=0;i<MAX_PLAYERS;i++){
  78. if(GetPlayerTeam(i)==0){SetSpawnInfo(i,1,280,1543.3428,-1610.6449,13.3828,269.6727,24,300,31,600,3,1);
  79. }
  80. if(GetPlayerTeam(i)==1){SetSpawnInfo(i,0,126,2229.3640,1805.3900,10.6541,90.7541,23,300,29,600,5,1);
  81. }
  82. SetPlayerHealth(i,0);
  83. }
  84. SendClientMessageToAll(COLOR_BLUE,"[TEAM SWAP]: Team have been swapped.");
  85. return 1;
  86. }
  87.  
  88. //RELOAD_GAMEMODE
  89. if(strcmp("/reload", cmdtext, true) == 0)
  90. {
  91. SendRconCommand("gmx");
  92. return 1;
  93. }
  94.  
  95. if(strcmp(cmd, "/kick", true) == 0)
  96. {
  97. new tmp[128];
  98. tmp = strtok(cmdtext, idx);
  99.  
  100. if(strlen(tmp) == 0) return SendClientMessage(playerid,COLOR_RED, "USAGE: /kick [playerid]");
  101.  
  102. Kick(strval(tmp));
  103. return 1;
  104. }
  105.  
  106. if(strcmp(cmd, "/ban", true) == 0)
  107. {
  108. new tmp[128];
  109. tmp = strtok(cmdtext, idx);
  110.  
  111. if(strlen(tmp) == 0) return SendClientMessage(playerid,COLOR_RED, "USAGE: /ban [playerid]");
  112.  
  113. Ban(strval(tmp));
  114. return 1;
  115. }
  116.  
  117. if(strcmp( cmd, "/goto", true ) == 0)
  118. {
  119. new tmp[256];
  120.  
  121. tmp = strtok(cmdtext,idx);
  122. if(!strlen(tmp)) { return 1; }
  123.  
  124. new Float:X, Float:Y, Float:Z;
  125.  
  126. if(GetPlayerVehicleID(playerid))
  127. {
  128. GetPlayerPos( strval(tmp), X, Y, Z );
  129. SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
  130. SendDeathMessage(playerid,strval(tmp,WEAPON_VEHICLE));
  131. } else {
  132. GetPlayerPos( strval(tmp), X, Y, Z );
  133. SetPlayerPos( playerid, X+2, Y+2, Z );
  134. SendDeathMessage(playerid,strval(tmp,WEAPON_VEHICLE));
  135. }
  136.  
  137. return 1;
  138. }
  139.  
  140. if(strcmp(cmd, "/bring", true) == 0)
  141. {
  142. new tmp[256];
  143.  
  144. tmp = strtok(cmdtext, idx);
  145.  
  146. if(!strlen(tmp)) { return 1; }
  147.  
  148. new Float:X, Float:Y, Float:Z;
  149.  
  150. if(GetPlayerVehicleID(strval(tmp)))
  151. {
  152. GetPlayerPos(playerid, X, Y, Z);
  153. SetVehiclePos(GetPlayerVehicleID(strval(tmp)), X+2, Y+2, Z);
  154. SendDeathMessage(strval(tmp,playerid,WEAPON_VEHICLE));
  155. } else {
  156. GetPlayerPos(playerid, X, Y, Z);
  157. SetPlayerPos(strval(tmp), X+2, Y+2, Z);
  158. SendDeathMessage(strval(tmp,playerid,WEAPON_VEHICLE));
  159. }
  160.  
  161. return 1;
  162. }
  163.  
  164. } //END_ADMIN
  165. else{
  166.  
  167. return SendClientMessage(playerid,COLOR_RED,"You do not have the permissions for this command."); //ELSE_ADMIN
  168. }
  169.  
  170. return SendClientMessage(playerid,COLOR_RED,"Command does not exist, or invalid syntax.");
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement