Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #define DIALOG_RCON_CMDS 1000//change these numbers to ur own so they dont interfere with your dialogs
- #define DIALOG_PARAM 1500//change this one too
- #define ENABLE_EXTRA_RCON_CMDS//comment to disable the extra commands for the server
- #include <a_samp>
- new command[14];
- new total[78];
- new paramneeded;
- public OnFilterScriptInit()
- {
- print("\n---------------------------------------");
- print("------GUIrcon by legodude started------");
- print("---------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/guircon", cmdtext, true, 10) == 0)
- {
- if(IsPlayerAdmin(playerid)==1)
- {
- 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");
- }
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_RCON_CMDS:
- {
- switch(response)
- {
- case 1:
- {
- switch(listitem)
- {
- case 0://cmdlist
- {
- format(command,sizeof(total),"cmdlist");
- paramdialog(playerid,0);
- }
- case 1://exit
- {
- format(command,sizeof(total),"exit");
- paramdialog(playerid,0);
- }
- case 2://echo [text]
- {
- format(command,sizeof(command),"echo");
- paramdialog(playerid,1);
- }
- case 3://hostname [name]
- {
- format(command,sizeof(command),"hostname");
- paramdialog(playerid,1);
- }
- case 4://gamemodetext [text]
- {
- format(command,sizeof(command),"gamemodetext");
- paramdialog(playerid,1);
- }
- case 5://mapname [name]
- {
- format(command,sizeof(command),"mapname");
- paramdialog(playerid,1);
- }
- case 6://exec [filename]
- {
- format(command,sizeof(command),"exec");
- paramdialog(playerid,1);
- }
- case 7://kick [id]
- {
- format(command,sizeof(command),"kick");
- paramdialog(playerid,1);
- }
- case 8://ban [id]
- {
- format(command,sizeof(command),"ban");
- paramdialog(playerid,1);
- }
- case 9://changemode [mode]
- {
- format(command,sizeof(command),"changemode");
- paramdialog(playerid,1);
- }
- case 10://gmx
- {
- format(command,sizeof(total),"gmx");
- paramdialog(playerid,0);
- }
- case 11://reloadbans
- {
- format(command,sizeof(total),"reloadbans");
- paramdialog(playerid,0);
- }
- case 12://reloadlog
- {
- format(command,sizeof(total),"reloadlog");
- paramdialog(playerid,0);
- }
- case 13://say [text]
- {
- format(command,sizeof(command),"say");
- paramdialog(playerid,1);
- }
- case 14://players
- {
- format(command,sizeof(total),"players");
- paramdialog(playerid,0);
- }
- case 15://banip [ip]
- {
- format(command,sizeof(command),"banip");
- paramdialog(playerid,1);
- }
- case 16://unbanip [ip]
- {
- format(command,sizeof(command),"unbanip");
- paramdialog(playerid,1);
- }
- case 17://gravity [integer]
- {
- format(command,sizeof(command),"gravity");
- paramdialog(playerid,1);
- }
- case 18://weather [id]
- {
- format(command,sizeof(command),"weather");
- paramdialog(playerid,1);
- }
- case 19://loadfs [fs]
- {
- format(command,sizeof(command),"loadfs");
- paramdialog(playerid,1);
- }
- case 20://unloadfs [fs]
- {
- format(command,sizeof(command),"unloadfs");
- paramdialog(playerid,1);
- }
- case 21://reloadfs [fs]
- {
- format(command,sizeof(command),"reloadfs");
- paramdialog(playerid,1);
- }
- case 22://rcon_password [pass]
- {
- format(command,sizeof(command),"rcon_password");
- paramdialog(playerid,1);
- }
- }
- }
- }
- }
- case DIALOG_PARAM:
- {
- switch(response)
- {
- case 1:
- {
- switch(paramneeded)
- {
- case 1:
- {
- format(total,sizeof(total),"%s %s",command,inputtext);
- SendRconCommand(total);
- }
- case 0:
- {
- if(strcmp(command,"cmdlist",false,7) == 0)
- {
- SendClientMessage(playerid,0xffffffff,"cmdlist");
- SendClientMessage(playerid,0xffffffff,"exit");
- SendClientMessage(playerid,0xffffffff,"echo [text]");
- SendClientMessage(playerid,0xffffffff,"hostname [text]");
- SendClientMessage(playerid,0xffffffff,"gamemodetext [text]");
- SendClientMessage(playerid,0xffffffff,"mapname [text]");
- SendClientMessage(playerid,0xffffffff,"exec [filename]");
- SendClientMessage(playerid,0xffffffff,"kick [id]");
- SendClientMessage(playerid,0xffffffff,"ban [id]");
- SendClientMessage(playerid,0xffffffff,"changemode [mode]");
- SendClientMessage(playerid,0xffffffff,"gmx");
- SendClientMessage(playerid,0xffffffff,"reloadbans");
- SendClientMessage(playerid,0xffffffff,"reloadlog");
- SendClientMessage(playerid,0xffffffff,"say [text]");
- SendClientMessage(playerid,0xffffffff,"players");
- SendClientMessage(playerid,0xffffffff,"banip [ip]");
- SendClientMessage(playerid,0xffffffff,"unbanip [ip]");
- SendClientMessage(playerid,0xffffffff,"gravity [float]");
- SendClientMessage(playerid,0xffffffff,"weather [id]");
- SendClientMessage(playerid,0xffffffff,"loadfs [fs]");
- SendClientMessage(playerid,0xffffffff,"unloadfs [fs]");
- SendClientMessage(playerid,0xffffffff,"reloadfs [fs]");
- SendClientMessage(playerid,0xffffffff,"rcon_password [pass]");
- }
- format(total,sizeof(total),"%s",command);
- SendRconCommand(total);
- }
- }
- new string[126];
- format(string,sizeof(string),"RCON: you executed the command: %s",total);
- SendClientMessage(playerid,0xffffffff,string);
- }
- }
- SendClientMessage(playerid,0xffffffff,"thanks for using guircon");
- }
- }
- return 1;
- }
- #if defined ENABLE_EXTRA_RCON_CMDS
- public OnRconCommand(cmd[])
- {
- if(strcmp(cmd,"tickcount",false,9) == 0)
- {
- new h,m,s,Y,M,D,tick;
- gettime(h,m,s);
- getdate(Y,M,D);
- tick = tickcount();
- printf("tickcount is %i at %i/%i/%i(YYYY/MM/DD) at %i:%i.%i",tick,Y,M,D,h,m,s);
- return 1;
- }
- return 0;
- }
- #endif
- paramdialog(playerid,needparam)
- {
- new string[128];
- if(needparam==1)
- {
- paramneeded = 1;
- format(string,sizeof(string),"the command %s needs a parameter.\nplease type the desired parameter below.");
- ShowPlayerDialog(playerid,DIALOG_PARAM,DIALOG_STYLE_INPUT,"parameter",string,"Ok","cancel");
- }
- else if(needparam==0)
- {
- paramneeded = 0;
- format(string,sizeof(string),"the command %s needs no parameters.\nit will execute when you press ok");
- ShowPlayerDialog(playerid,DIALOG_PARAM,DIALOG_STYLE_MSGBOX,"parameter",string,"Ok","cancel");
- }
- }
Add Comment
Please, Sign In to add comment