ulbi1990

uRconConsole v1.0 R2 english

May 16th, 2013
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.86 KB | None | 0 0
  1. /*
  2.             uRcon Console CMDS is a for the console made Script, which
  3.             makes it possible to use commands which are standard Ingame
  4.             in the console
  5.            
  6.             You are allowed to edit this script for your own usage.
  7.             You are allowed to use this script for your server.
  8.             It would be nice when the cmd /credits keeps.
  9.            
  10.             You won't re-release this script by calming it as your own.
  11.            
  12.             INFORMATION:
  13.            
  14.             The commands gets since v1.0 R2 with "/" directly in the
  15.             console used.
  16.            
  17.             You can define the firt charactere which shall be used by
  18.             changing the "/" to your custom charactere.
  19.            
  20.                 All commands gets listed with /cmds and /cmds2
  21.                             (More will follow!)
  22.                            
  23.         Bugs and ideas can be sended via the following links as pm to me:
  24.                 http://gta-sa-mp.de/forum/user/290-ulbi1990/
  25.                 http://forum.sa-mp.de/index.php?page=User&userID=23895
  26.                 http://forum.sa-mp.com/member.php?u=155872
  27.                
  28.   You can also write a Feedback/Bug Reports and Ideas in the following thread:
  29.                             http://bit.ly/15OzlMa
  30. */
  31. #include <a_samp>
  32. #include <sscanf2>
  33.  
  34. #if !defined RCMD_PREFIX
  35.     #define RCMD_PREFIX "/" //define the prefix which shall be used! Standard "/"
  36. #endif
  37.  
  38. #if !defined rcmd
  39.     #define rcmd(%1,%2,%3) if((strcmp((%3), RCMD_PREFIX #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (rcmd_%1(""))) || (((%3)[(%2) + 1] == 32) && (rcmd_%1((%3)[(%2) + 2]))))) return 1
  40. #endif
  41.  
  42. new ChatBlock;
  43.  
  44. forward KickTimer(playerid);
  45.  
  46. public OnFilterScriptInit()
  47. {
  48.     print(" ");
  49.     print("\t\t|=================================|");
  50.     print("\t\t|    uRcon Console CMDS v1.0 R2   |");
  51.     print("\t\t|       scriptet by ulbi1990      |");
  52.     printf("\t\t|   %scmds - shows all commands   |", RCMD_PREFIX);
  53.     print("\t\t|=================================|");
  54.     print(" ");
  55.     return 1;
  56. }
  57.  
  58. public OnFilterScriptExit()
  59. {
  60.     return 1;
  61. }
  62.  
  63. public OnRconCommand(cmd[])
  64. {
  65.     rcmd(cmds,4,cmd);
  66.     rcmd(kickall,7,cmd);
  67.     rcmd(slapall,7,cmd);
  68.     rcmd(cc,2,cmd);
  69.     rcmd(freezeall,9,cmd);
  70.     rcmd(unfreezeall,11,cmd);
  71.     rcmd(blockchat,9,cmd);
  72.     rcmd(allowchat,9,cmd);
  73.     rcmd(killall,7,cmd);
  74.     rcmd(healall,7,cmd);
  75.     rcmd(allgod,6,cmd);
  76.     rcmd(allgodoff,9,cmd);
  77.     rcmd(kick,4,cmd);
  78.     rcmd(ann,3,cmd);
  79.     rcmd(credits,7,cmd);
  80.     rcmd(slap,4,cmd);
  81.     rcmd(freeze,6,cmd);
  82.     rcmd(unfreeze,8,cmd);
  83.     rcmd(heal,4,cmd);
  84.     rcmd(kill,4,cmd);
  85.     rcmd(god,3,cmd);
  86.     rcmd(godoff,6,cmd);
  87.     rcmd(cmds2,5,cmd);
  88.     return 1;
  89. }
  90.  
  91. public OnPlayerText(playerid,text[])
  92. {
  93.     if(ChatBlock==1)
  94.     {
  95.         SendClientMessage(playerid,0xFF0000FF,"Der Chat wurde von einem Administrator geblockt!");
  96.         return 0;
  97.     }
  98.     return 1;
  99. }
  100.  
  101. rcmd_cmds(command[])
  102. {
  103.     if(!strlen(command))
  104.     {
  105.         printf("%scredits - Shows a list about people which make this script possible",RCMD_PREFIX);
  106.         printf("%skickall - kicks all players on the server",RCMD_PREFIX);
  107.         printf("%sslapall - slaps all players on the server",RCMD_PREFIX);
  108.         printf("%scc - clears the chat for all players",RCMD_PREFIX);
  109.         printf("%sfreezeall - freezes all players on the server",RCMD_PREFIX);
  110.         printf("%sunfreezeall - unfreezes all players on the server",RCMD_PREFIX);
  111.         printf("%sblockchat - blocks the chat for all players",RCMD_PREFIX);
  112.         printf("%sallowchat - unblocks the chat for all players",RCMD_PREFIX);
  113.         printf("%shealall - heals all players on the server",RCMD_PREFIX);
  114.         printf("%skillall - Kills all players on the server",RCMD_PREFIX);
  115.         printf("%sallgod - gives all players godmode",RCMD_PREFIX);
  116.         printf("%sallgodoff - takes the godmode from all players",RCMD_PREFIX);
  117.         printf("%skick <Playerid> <reason> - kicks a specific player with a reason",RCMD_PREFIX);
  118.         printf("%sann <Text> - shows a announcment as GameText for all players",RCMD_PREFIX);
  119.         print(" ");
  120.         printf("%scmds2 - next cmdlist",RCMD_PREFIX);
  121.     }
  122.     return 1;
  123. }
  124.  
  125. rcmd_cmds2(command[])
  126. {
  127.     if(!strlen(command))
  128.     {
  129.         printf("%sslap <Playerid> - slaps a specific player on the server",RCMD_PREFIX);
  130.         printf("%sfreeze <Playerid> - freezes a specific player on the server",RCMD_PREFIX);
  131.         printf("%sunfreeze <Playerid> - unfreezes a specific player on the server",RCMD_PREFIX);
  132.         printf("%sheal <Playerid> - heals a specific player on the server",RCMD_PREFIX);
  133.         printf("%skill <Playerid> - kills a specific player on the server",RCMD_PREFIX);
  134.         printf("%sgod <Playerid> - gives a specific player godmode",RCMD_PREFIX);
  135.         printf("%sgodoff <Playerid> - takes from a specific player the godmode",RCMD_PREFIX);
  136.     }
  137.     return 1;
  138. }
  139.  
  140. rcmd_kickall(command[])
  141. {
  142.     if(!strlen(command))
  143.     {
  144.         for(new i=0;i<MAX_PLAYERS;i++)
  145.         {
  146.             Kick(i);
  147.         }
  148.         print("All players got kicked!");
  149.     }
  150.     return 1;
  151. }
  152.  
  153. rcmd_slapall(command[])
  154. {
  155.     if(!strlen(command))
  156.     {
  157.         for(new i=0;i<MAX_PLAYERS;i++)
  158.         {
  159.             new Float:zPos[3];
  160.             GetPlayerPos(i,zPos[0],zPos[1],zPos[2]);
  161.             SetPlayerPos(i,zPos[0],zPos[1],zPos[2]+12);
  162.         }
  163.         print("All players got slaped!");
  164.     }
  165.     return 1;
  166. }
  167.  
  168. rcmd_cc(command[])
  169. {
  170.     if(!strlen(command))
  171.     {
  172.         for(new i=0;i<100;i++)
  173.         {
  174.             SendClientMessageToAll(-1," ");
  175.         }
  176.         print("Chat got cleared!");
  177.     }
  178.     return 1;
  179. }
  180.  
  181. rcmd_freezeall(command[])
  182. {
  183.     if(!strlen(command))
  184.     {
  185.         for(new i=0;i<MAX_PLAYERS;i++)
  186.         {
  187.             TogglePlayerControllable(i,0);
  188.         }
  189.         print("All players got freezed!");
  190.     }
  191.     return 1;
  192. }
  193.  
  194. rcmd_unfreezeall(command[])
  195. {
  196.     if(!strlen(command))
  197.     {
  198.         for(new i=0;i<MAX_PLAYERS;i++)
  199.         {
  200.             TogglePlayerControllable(i,1);
  201.         }
  202.         print("Allall players got unfreezed!");
  203.     }
  204.     return 1;
  205. }
  206.  
  207. rcmd_blockchat(command[])
  208. {
  209.     if(!strlen(command))
  210.     {
  211.         print("Chat gets now blocked!");
  212.         ChatBlock=1;
  213.     }
  214.     return 1;
  215. }
  216.  
  217. rcmd_allowchat(command[])
  218. {
  219.     if(!strlen(command))
  220.     {
  221.         print("Chat is now unblocked!");
  222.         ChatBlock=0;
  223.     }
  224.     return 1;
  225. }
  226.  
  227. rcmd_killall(command[])
  228. {
  229.     if(!strlen(command))
  230.     {
  231.         for(new i=0;i<MAX_PLAYERS;i++)
  232.         {
  233.             SetPlayerHealth(i,-1);
  234.         }
  235.         print("All players got killed!");
  236.     }
  237.     return 1;
  238. }
  239.  
  240. rcmd_healall(command[])
  241. {
  242.     if(!strlen(command))
  243.     {
  244.         for(new i=0;i<MAX_PLAYERS;i++)
  245.         {
  246.             SetPlayerHealth(i,100);
  247.         }
  248.         print("All players got healed!");
  249.     }
  250.     return 1;
  251. }
  252.  
  253. rcmd_allgod(command[])
  254. {
  255.     if(!strlen(command))
  256.     {
  257.         for(new i=0;i<MAX_PLAYERS;i++)
  258.         {
  259.             SetPlayerHealth(i,10000000);
  260.         }
  261.         print("All players got set to godmode!");
  262.     }
  263.     return 1;
  264. }
  265.  
  266. rcmd_allgodoff(command[])
  267. {
  268.     if(!strlen(command))
  269.     {
  270.         for(new i=0;i<MAX_PLAYERS;i++)
  271.         {
  272.             SetPlayerHealth(i,100);
  273.         }
  274.         print("All players got godmode removed!");
  275.     }
  276.     return 1;
  277. }
  278.  
  279. rcmd_kick(command[])
  280. {
  281.     new pID,reason[56],name[MAX_PLAYER_NAME+1],str[128];
  282.     if(strlen(command)) return printf("[USAGE]: \"%skick [Playerid] [Reason]\"", RCMD_PREFIX);
  283.     {
  284.         if(sscanf(command,"us[55]",pID,reason)) return printf("[USAGE]: \"%skick [Playerid] [Reason]\"", RCMD_PREFIX);
  285.         {
  286.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  287.             {
  288.                 GetPlayerName(pID,name,sizeof(name));
  289.                 format(str,sizeof(str),"%s got kicked via Rcon console. [Reason: %s]",name,reason);
  290.                 SendClientMessageToAll(0xFF0000FF,str);
  291.                 printf("%s",str);
  292.                 SetTimerEx("KickTimer",500,0,"i",pID);
  293.             }
  294.         }
  295.     }
  296.     return 1;
  297. }
  298.  
  299. rcmd_ann(command[])
  300. {
  301.     new announce[56];
  302.     if(strlen(command)) return printf("[USaGE]: \"%sann [Announce]\"", RCMD_PREFIX);
  303.     {
  304.         if(sscanf(command,"s[56]",announce)) return printf("[USAGE]: \"%sann [Announce]\"", RCMD_PREFIX);
  305.         {
  306.             GameTextForAll(announce,4000,3);
  307.             printf("Announce: %s",announce);
  308.         }
  309.     }
  310.     return 1;
  311. }
  312.  
  313. rcmd_credits(command[])
  314. {
  315.     if(!strlen(command))
  316.     {
  317.         print("Scriptidea & Script: ulbi1990");
  318.         print("Rcmd Define: Correlli");
  319.         print("Sscanf2: Alex aka Y_Less");
  320.         print("a_samp: SA:MP Team");
  321.     }
  322.     return 1;
  323. }
  324.  
  325. rcmd_slap(command[])
  326. {
  327.     new pID,Float:zPos[3];
  328.     if(strlen(command)) return printf("[USAGE]: \"%sslap [Playerid]\"", RCMD_PREFIX);
  329.     {
  330.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sslap [Playerid]\"", RCMD_PREFIX);
  331.         {
  332.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  333.             {
  334.                 GetPlayerPos(pID,zPos[0],zPos[1],zPos[2]);
  335.                 SetPlayerPos(pID,zPos[0],zPos[1],zPos[2]+12);
  336.                 printf("%d got slaped!",pID);
  337.             }
  338.         }
  339.     }
  340.     return 1;
  341. }
  342.  
  343. rcmd_freeze(command[])
  344. {
  345.     new pID;
  346.     if(strlen(command)) return printf("[USAGE]: \"%sfreeze [Playerid]\"", RCMD_PREFIX);
  347.     {
  348.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sfreeze [Playerid]\"", RCMD_PREFIX);
  349.         {
  350.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  351.             {
  352.                 TogglePlayerControllable(pID,0);
  353.                 printf("%d got freezed!",pID);
  354.             }
  355.         }
  356.     }
  357.     return 1;
  358. }
  359.  
  360. rcmd_unfreeze(command[])
  361. {
  362.     new pID;
  363.     if(strlen(command)) return printf("[USAGE]: \"%sunfreeze [Playerid]\"", RCMD_PREFIX);
  364.     {
  365.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sunfreeze [Playerid]\"", RCMD_PREFIX);
  366.         {
  367.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  368.             {
  369.                 TogglePlayerControllable(pID,1);
  370.                 printf("%d got unfreezed!",pID);
  371.             }
  372.         }
  373.     }
  374.     return 1;
  375. }
  376.  
  377. rcmd_heal(command[])
  378. {
  379.     new pID;
  380.     if(strlen(command)) return printf("[USAGE]: \"%sheal [Playerid]\"", RCMD_PREFIX);
  381.     {
  382.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sheal [Playerid]\"", RCMD_PREFIX);
  383.         {
  384.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  385.             {
  386.                 SetPlayerHealth(pID,100);
  387.                 printf("%d got healed!",pID);
  388.             }
  389.         }
  390.     }
  391.     return 1;
  392. }
  393.  
  394. rcmd_kill(command[])
  395. {
  396.     new pID;
  397.     if(strlen(command)) return printf("[USAGE]: \"%skill [Playerid]\"", RCMD_PREFIX);
  398.     {
  399.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%skill [Playerid]\"", RCMD_PREFIX);
  400.         {
  401.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  402.             {
  403.                 SetPlayerHealth(pID,-1);
  404.                 printf("%d got killed!",pID);
  405.             }
  406.         }
  407.     }
  408.     return 1;
  409. }
  410.  
  411. rcmd_god(command[])
  412. {
  413.     new pID;
  414.     if(strlen(command)) return printf("[USAGE]: \"%sgod [Playerid]\"", RCMD_PREFIX);
  415.     {
  416.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sgod [Playerid]\"", RCMD_PREFIX);
  417.         {
  418.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  419.             {
  420.                 SetPlayerHealth(pID,10000000000);
  421.                 printf("%d got set to godmode!",pID);
  422.             }
  423.         }
  424.     }
  425.     return 1;
  426. }
  427.  
  428. rcmd_godoff(command[])
  429. {
  430.     new pID;
  431.     if(strlen(command)) return printf("[USAGE]: \"%sgodoff [Playerid]\"", RCMD_PREFIX);
  432.     {
  433.         if(sscanf(command,"u",pID)) return printf("[USAGE]: \"%sgodoff [Playerid]\"", RCMD_PREFIX);
  434.         {
  435.             if(pID==INVALID_PLAYER_ID) return print("This player isn't connected!");
  436.             {
  437.                 SetPlayerHealth(pID,100);
  438.                 printf("%d got godmode removed!",pID);
  439.             }
  440.         }
  441.     }
  442.     return 1;
  443. }
  444.  
  445. public KickTimer(playerid)
  446. {
  447.     Kick(playerid);
  448.     return 1;
  449. }
Advertisement
Add Comment
Please, Sign In to add comment