Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define DIALOG_MAIN 1
- #define DIALOG_ECHO 2
- #define DIALOG_HOSTNAME 3
- #define DIALOG_GAMEMODETEXT 4
- #define DIALOG_MAPNAME 5
- #define DIALOG_EXECUTE 6
- #define DIALOG_CHANGEMODE 7
- #define DIALOG_SECOND 8
- #define DIALOG_SAY 9
- #define DIALOG_BANIP 10
- #define DIALOG_UNBANIP 11
- #define DIALOG_LOADFS 12
- #define DIALOG_UNLOADFS 13
- CMD:panel(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- ShowPlayerDialog(playerid,DIALOG_MAIN,DIALOG_STYLE_LIST,"Rcon Panel","Exit\nEcho\nHostName\nGameModeText\nMapName\nExecute\nChangemode","Select","Next");
- return 1;
- }
- public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
- {
- if(dialogid == DIALOG_CHANGEMODE)
- {
- if(!response) return 0;
- new pName[MAX_PLAYER_NAME],string[124],Command[124];
- GetPlayerName(playerid,pName,sizeof(pName));
- format(string,sizeof(string),"Administrator %s changed the mode to %s",pName,inputtext);
- format(Command,sizeof(Command),"changemode %s",inputtext);
- SendRconCommand(Command);
- }
- if(dialogid == DIALOG_ECHO)
- {
- if(!response) return 0;
- new pName[MAX_PLAYER_NAME],string[124],Command[124];
- GetPlayerName(playerid,pName,sizeof(pName));
- format(string,sizeof(string),"Administrator %s: %s",pName,inputtext);
- format(Command,sizeof(Command),"echo %s",string);
- SendRconCommand(Command);
- }
- if(dialogid == DIALOG_MAPNAME)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"mapname %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"Mapname changed to %s",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_GAMEMODETEXT)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"gamemodetext %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"GameModeText changed to %s",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_HOSTNAME)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"hostname %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"Hostname changed to %s",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_EXECUTE)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"exec %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"%s has been executed.",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_SECOND)
- {
- if(!response) return 0;
- if(listitem == 0)
- {
- new pName[MAX_PLAYER_NAME],string[124];
- GetPlayerName(playerid,pName,sizeof(pName));
- format(string,sizeof(string),"Administrator %s restarted the server",pName);
- SendClientMessageToAll(-1,string);
- SendRconCommand("gmx");
- }
- if(listitem == 1)
- {
- SendClientMessage(playerid,-1,"Bans reloaded.");
- SendRconCommand("reloadbans");
- }
- if(listitem == 2)
- {
- SendClientMessage(playerid,-1,"Log reloaded.");
- SendRconCommand("reloadlogs");
- }
- if(listitem == 3)
- {
- ShowPlayerDialog(playerid,DIALOG_SAY,DIALOG_STYLE_INPUT,"Say","Please input the text to say","Say","Close");
- }
- if(listitem == 4)
- {
- SendRconCommand("players");
- }
- if(listitem == 5)
- {
- ShowPlayerDialog(playerid,DIALOG_BANIP,DIALOG_STYLE_INPUT,"BanIP","Input the IP to ban","Ban","Close");
- }
- if(listitem == 6)
- {
- ShowPlayerDialog(playerid,DIALOG_UNBANIP,DIALOG_STYLE_INPUT,"UnbanIP","Input the IP to unban","Unban","Close");
- }
- if(listitem == 7)
- {
- ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Loadfs","Input the fs to load","Load","Close");
- }
- if(listitem == 8)
- {
- ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Unloadfs","Input the fs to unload","Unload","Close");
- }
- }
- if(dialogid == DIALOG_LOADFS)
- {
- if(!response) return 0;
- new command[64];
- format(command,sizeof(command),"loadfs %s",inputtext);
- SendRconCommand(command);
- }
- if(dialogid == DIALOG_UNLOADFS)
- {
- if(!response) return 0;
- new command[64];
- format(command,sizeof(command),"unloadfs %s",inputtext);
- SendRconCommand(command);
- }
- if(dialogid == DIALOG_BANIP)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"banip %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"%s has been banned.",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_UNBANIP)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"unbanip %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"%s has been unbanned.",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_SAY)
- {
- if(!response) return 0;
- new command[64],string[124];
- format(command,sizeof(command),"say %s",inputtext);
- SendRconCommand(command);
- format(string,sizeof(string),"%s has been said.",inputtext);
- SendClientMessage(playerid,-1,string);
- }
- if(dialogid == DIALOG_MAIN)
- {
- if(!response) return ShowPlayerDialog(playerid,DIALOG_SECOND,DIALOG_STYLE_LIST,"Rcon Panel","Gmx\nReloadbans\nReloadlog\nSay\nPlayers\nbanip\nunbanip\nloadfs\nunloadfs","Select","Close");
- if(listitem == 0)
- {
- new pName[MAX_PLAYER_NAME],string[124];
- GetPlayerName(playerid,pName,sizeof(pName));
- format(string,sizeof(string),"Administrator %s has closed the server.",pName);
- SendClientMessageToAll(-1,string);
- SendRconCommand("exit");
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid,DIALOG_ECHO,DIALOG_STYLE_INPUT,"Echo","Input text to echo.","Echo","Close");
- }
- if(listitem == 2)
- {
- ShowPlayerDialog(playerid,DIALOG_HOSTNAME,DIALOG_STYLE_INPUT,"HostName","Input text to set the hostname.","Set","Close");
- }
- if(listitem == 3)
- {
- ShowPlayerDialog(playerid,DIALOG_GAMEMODETEXT,DIALOG_STYLE_INPUT,"GameModeText","Input the text you want to set as the gamemodetext","Set","Close");
- }
- if(listitem == 4)
- {
- ShowPlayerDialog(playerid,DIALOG_MAPNAME,DIALOG_STYLE_INPUT,"MapName","Input the text you want to set as the map name","Set","Close");
- }
- if(listitem == 5)
- {
- ShowPlayerDialog(playerid,DIALOG_EXECUTE,DIALOG_STYLE_INPUT,"Execute","Input the .cfg file you want to execute","Execute","Exit");
- }
- if(listitem == 6)
- {
- ShowPlayerDialog(playerid,DIALOG_CHANGEMODE,DIALOG_STYLE_INPUT,"Changemode","Input the gamemode you want to change too","Changemode","Close");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement