legodude

legodude

Aug 3rd, 2010
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.07 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #define DIALOG_RCON_CMDS 1000//change these numbers to ur own so they dont interfere with your dialogs
  3. #define DIALOG_PARAM 1500//change this one too
  4. #define ENABLE_EXTRA_RCON_CMDS//comment to disable the extra commands for the server
  5. #include <a_samp>
  6. new command[14];
  7. new total[78];
  8. new paramneeded;
  9. public OnFilterScriptInit()
  10. {
  11.     print("\n---------------------------------------");
  12.     print("------GUIrcon by legodude started------");
  13.     print("---------------------------------------\n");
  14.     return 1;
  15. }
  16.  
  17. public OnFilterScriptExit()
  18. {
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerCommandText(playerid, cmdtext[])
  23. {
  24.     if (strcmp("/guircon", cmdtext, true, 10) == 0)
  25.     {
  26.         if(IsPlayerAdmin(playerid)==1)
  27.         {
  28.         ShowPlayerDialog(playerid,DIALOG_RCON_CMDS,DIALOG_STYLE_LIST,"choose your command","cmdlist\nexit\necho\nhostname\ngamemodetext\nmapname\nexec\nkick\nban\nchangemode\ngmx\nreloadbans\nreloadlog\nsay\nplayers\nbanip\nunbanip\ngravity\nweather\nloadfs\nunloadfs\nreloadfs\nrcon_password","Ok","Cancel");
  29.         }
  30.         return 1;
  31.     }
  32.     return 0;
  33. }
  34.  
  35. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  36. {
  37.     switch(dialogid)
  38.     {
  39.         case DIALOG_RCON_CMDS:
  40.         {
  41.          switch(response)
  42.             {
  43.                 case 1:
  44.                 {
  45.                     switch(listitem)
  46.                     {
  47.                         case 0://cmdlist
  48.                         {
  49.                         format(command,sizeof(total),"cmdlist");
  50.                         paramdialog(playerid,0);
  51.                         }
  52.                         case 1://exit
  53.                         {
  54.                         format(command,sizeof(total),"exit");
  55.                         paramdialog(playerid,0);
  56.                         }
  57.                         case 2://echo [text]
  58.                         {
  59.                         format(command,sizeof(command),"echo");
  60.                         paramdialog(playerid,1);
  61.                         }
  62.                         case 3://hostname [name]
  63.                         {
  64.                         format(command,sizeof(command),"hostname");
  65.                         paramdialog(playerid,1);
  66.                         }
  67.                         case 4://gamemodetext [text]
  68.                         {
  69.                         format(command,sizeof(command),"gamemodetext");
  70.                         paramdialog(playerid,1);
  71.                         }
  72.                         case 5://mapname [name]
  73.                         {
  74.                         format(command,sizeof(command),"mapname");
  75.                         paramdialog(playerid,1);
  76.                         }
  77.                         case 6://exec [filename]
  78.                         {
  79.                         format(command,sizeof(command),"exec");
  80.                         paramdialog(playerid,1);
  81.                         }
  82.                         case 7://kick [id]
  83.                         {
  84.                         format(command,sizeof(command),"kick");
  85.                         paramdialog(playerid,1);
  86.                         }
  87.                         case 8://ban [id]
  88.                         {
  89.                         format(command,sizeof(command),"ban");
  90.                         paramdialog(playerid,1);
  91.                         }
  92.                         case 9://changemode [mode]
  93.                         {
  94.                         format(command,sizeof(command),"changemode");
  95.                         paramdialog(playerid,1);
  96.                         }
  97.                         case 10://gmx
  98.                         {
  99.                         format(command,sizeof(total),"gmx");
  100.                         paramdialog(playerid,0);
  101.                         }
  102.                         case 11://reloadbans
  103.                         {
  104.                         format(command,sizeof(total),"reloadbans");
  105.                         paramdialog(playerid,0);
  106.                         }
  107.                         case 12://reloadlog
  108.                         {
  109.                         format(command,sizeof(total),"reloadlog");
  110.                         paramdialog(playerid,0);
  111.                         }
  112.                         case 13://say [text]
  113.                         {
  114.                         format(command,sizeof(command),"say");
  115.                         paramdialog(playerid,1);
  116.                         }
  117.                         case 14://players
  118.                         {
  119.                         format(command,sizeof(total),"players");
  120.                         paramdialog(playerid,0);
  121.                         }
  122.                         case 15://banip [ip]
  123.                         {
  124.                         format(command,sizeof(command),"banip");
  125.                         paramdialog(playerid,1);
  126.                         }
  127.                         case 16://unbanip [ip]
  128.                         {
  129.                         format(command,sizeof(command),"unbanip");
  130.                         paramdialog(playerid,1);
  131.                         }
  132.                         case 17://gravity [integer]
  133.                         {
  134.                         format(command,sizeof(command),"gravity");
  135.                         paramdialog(playerid,1);
  136.                         }
  137.                         case 18://weather [id]
  138.                         {
  139.                         format(command,sizeof(command),"weather");
  140.                         paramdialog(playerid,1);
  141.                         }
  142.                         case 19://loadfs [fs]
  143.                         {
  144.                         format(command,sizeof(command),"loadfs");
  145.                         paramdialog(playerid,1);
  146.                         }
  147.                         case 20://unloadfs [fs]
  148.                         {
  149.                         format(command,sizeof(command),"unloadfs");
  150.                         paramdialog(playerid,1);
  151.                         }
  152.                         case 21://reloadfs [fs]
  153.                         {
  154.                         format(command,sizeof(command),"reloadfs");
  155.                         paramdialog(playerid,1);
  156.                         }
  157.                         case 22://rcon_password [pass]
  158.                         {
  159.                         format(command,sizeof(command),"rcon_password");
  160.                         paramdialog(playerid,1);
  161.                         }
  162.                     }
  163.                 }
  164.             }
  165.         }
  166.         case DIALOG_PARAM:
  167.         {
  168.             switch(response)
  169.             {
  170.                 case 1:
  171.                 {
  172.                     switch(paramneeded)
  173.                     {
  174.                         case 1:
  175.                         {
  176.                         format(total,sizeof(total),"%s %s",command,inputtext);
  177.                         SendRconCommand(total);
  178.                         }
  179.                         case 0:
  180.                         {
  181.                         if(strcmp(command,"cmdlist",false,7) == 0)
  182.                             {
  183.                             SendClientMessage(playerid,0xffffffff,"cmdlist");
  184.                             SendClientMessage(playerid,0xffffffff,"exit");
  185.                             SendClientMessage(playerid,0xffffffff,"echo [text]");
  186.                             SendClientMessage(playerid,0xffffffff,"hostname [text]");
  187.                             SendClientMessage(playerid,0xffffffff,"gamemodetext [text]");
  188.                             SendClientMessage(playerid,0xffffffff,"mapname [text]");
  189.                             SendClientMessage(playerid,0xffffffff,"exec [filename]");
  190.                             SendClientMessage(playerid,0xffffffff,"kick [id]");
  191.                             SendClientMessage(playerid,0xffffffff,"ban [id]");
  192.                             SendClientMessage(playerid,0xffffffff,"changemode [mode]");
  193.                             SendClientMessage(playerid,0xffffffff,"gmx");
  194.                             SendClientMessage(playerid,0xffffffff,"reloadbans");
  195.                             SendClientMessage(playerid,0xffffffff,"reloadlog");
  196.                             SendClientMessage(playerid,0xffffffff,"say [text]");
  197.                             SendClientMessage(playerid,0xffffffff,"players");
  198.                             SendClientMessage(playerid,0xffffffff,"banip [ip]");
  199.                             SendClientMessage(playerid,0xffffffff,"unbanip [ip]");
  200.                             SendClientMessage(playerid,0xffffffff,"gravity [float]");
  201.                             SendClientMessage(playerid,0xffffffff,"weather [id]");
  202.                             SendClientMessage(playerid,0xffffffff,"loadfs [fs]");
  203.                             SendClientMessage(playerid,0xffffffff,"unloadfs [fs]");
  204.                             SendClientMessage(playerid,0xffffffff,"reloadfs [fs]");
  205.                             SendClientMessage(playerid,0xffffffff,"rcon_password [pass]");
  206.                             }
  207.                         format(total,sizeof(total),"%s",command);
  208.                         SendRconCommand(total);
  209.                         }
  210.                     }
  211.                     new string[126];
  212.                     format(string,sizeof(string),"RCON: you executed the command: %s",total);
  213.                     SendClientMessage(playerid,0xffffffff,string);
  214.                 }
  215.             }
  216.             SendClientMessage(playerid,0xffffffff,"thanks for using guircon");
  217.         }
  218.     }
  219.     return 1;
  220. }
  221. #if defined ENABLE_EXTRA_RCON_CMDS
  222. public OnRconCommand(cmd[])
  223. {
  224.     if(strcmp(cmd,"tickcount",false,9) == 0)
  225.     {
  226.     new h,m,s,Y,M,D,tick;
  227.     gettime(h,m,s);
  228.     getdate(Y,M,D);
  229.     tick = tickcount();
  230.     printf("tickcount is %i at %i/%i/%i(YYYY/MM/DD) at %i:%i.%i",tick,Y,M,D,h,m,s);
  231.     return 1;
  232.     }
  233.     return 0;
  234. }
  235. #endif
  236. paramdialog(playerid,needparam)
  237. {
  238. new string[128];
  239. if(needparam==1)
  240. {
  241. paramneeded = 1;
  242. format(string,sizeof(string),"the command %s needs a parameter.\nplease type the desired parameter below.");
  243. ShowPlayerDialog(playerid,DIALOG_PARAM,DIALOG_STYLE_INPUT,"parameter",string,"Ok","cancel");
  244. }
  245. else if(needparam==0)
  246. {
  247. paramneeded = 0;
  248. format(string,sizeof(string),"the command %s needs no parameters.\nit will execute when you press ok");
  249. ShowPlayerDialog(playerid,DIALOG_PARAM,DIALOG_STYLE_MSGBOX,"parameter",string,"Ok","cancel");
  250. }
  251. }
Add Comment
Please, Sign In to add comment