Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==============================================
- INCLUDES
- ================================================*/
- #include <a_samp>
- #include <zcmd>
- /*==============================================
- OPTIONS(and other defines)
- ================================================*/
- #define trcpass "changeme"
- #define USE_03zR2_Above true //change to false if your server version is below 0.3z-R2
- #define DIALOG_TRCON_LOGIN 874
- #define DIALOG_TRCON 542
- #define DIALOG_INPUT 643
- /*==============================================
- GLOBAL VARIABLES
- ================================================*/
- new bool:TrcAdmin[MAX_PLAYERS];
- new inputdialog[MAX_PLAYERS];
- #define Tversion "(v1.0)"
- /*==============================================
- CALLBACKS
- ================================================*/
- public OnFilterScriptInit()
- {
- print("==========================================");
- printf(" T-RCON %s",Tversion);
- print(" (Easy RCON system)");
- print(" by Turbo");
- print(" Succesfully loaded");
- print("======================================");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("====================================");
- printf(" T-RCON %s",Tversion);
- print(" (Easy RCON system)");
- print(" by Turbo");
- print(" Succesfully un-loaded");
- print("=====================================");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- ResetVariables(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- ResetVariables(playerid);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_TRCON_LOGIN)
- {
- if(!response) return 1;
- if(!strcmp(inputtext, trcpass))
- {
- TrcAdmin[playerid] = true;
- SendClientMessage(playerid, -1, "Login success! :D");
- }
- else
- {
- SendClientMessage(playerid, -1, "invaild pass :P");
- }
- return 1;
- }
- if(dialogid == DIALOG_TRCON)
- {
- if(!response) return 1;
- switch(listitem)
- {
- case 0: SendRconCommand("gmx");
- case 1: SendRconCommand("reloadbans");
- case 2: SendRconCommand("exit");
- case 3:
- {
- inputdialog[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new hostname", "change", "cancel");
- return 1;
- }
- case 4:
- {
- inputdialog[playerid] = 2;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the text to say(as admin)", "Say", "cancel");
- return 1;
- }
- case 5:
- {
- inputdialog[playerid] = 3;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the desired password\nNOTE: type '0' if you want to remove the server password", "Confirm", "cancel");
- return 1;
- }
- case 6:
- {
- inputdialog[playerid] = 4;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new GameMode Text\nDisplayed in client under the GameMode", "Change", "cancel");
- return 1;
- }
- case 7:
- {
- inputdialog[playerid] = 5;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the Weather ID", "Change", "cancel");
- return 1;
- }
- case 8:
- {
- inputdialog[playerid] = 6;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the Gravity\n deafult Gravity = 0.008 ", "Change", "cancel");
- return 1;
- }
- case 9:
- {
- inputdialog[playerid] = 7;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new rcon password ", "Change", "cancel");
- return 1;
- }
- case 10:
- {
- inputdialog[playerid] = 8;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new Web Url", "Change", "cancel");
- return 1;
- }
- case 11:
- {
- inputdialog[playerid] = 17;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new Map Name", "Change", "cancel");
- return 1;
- }
- case 12:
- {
- inputdialog[playerid] = 9;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the name of the fs(filterscript) to load", "Load", "cancel");
- return 1;
- }
- case 13:
- {
- inputdialog[playerid] = 10;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the name of the filterscript to un-load", "un-load", "cancel");
- return 1;
- }
- case 14:
- {
- inputdialog[playerid] = 11;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input name of the filterscript to reload", "reload", "cancel");
- return 1;
- }
- case 15: SendRconCommand("reloadlogs");
- case 16:
- {
- inputdialog[playerid] = 12;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the ID(of the player) to Kick", "Kick", "cancel");
- return 1;
- }
- case 17:
- {
- inputdialog[playerid] = 13;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the ID(of the player) to Ban", "Ban", "cancel");
- return 1;
- }
- case 18:
- {
- inputdialog[playerid] = 14;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the ip to Ban", "Ban", "cancel");
- return 1;
- }
- case 19:
- {
- inputdialog[playerid] = 15;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the ip to Un-Ban", "UnBan", "cancel");
- return 1;
- }
- case 20:
- {
- inputdialog[playerid] = 16;
- ShowPlayerDialog(playerid, DIALOG_INPUT, DIALOG_STYLE_INPUT,"T-RCON","Input the new Language(shown in the client)", "change", "cancel");
- return 1;
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_INPUT)
- {
- new string[128];
- if(!response) return 1;
- switch(inputdialog[playerid])
- {
- case 1:
- {
- format(string, sizeof(string),"hostname %s",inputtext);
- SendRconCommand(string);
- }
- case 2:
- {
- format(string, sizeof(string),"say %s",inputtext);
- SendRconCommand(string);
- }
- case 3:
- {
- format(string, sizeof(string),"password %s",inputtext);
- SendRconCommand(string);
- }
- case 4:
- {
- format(string, sizeof(string),"gamemodetext %s",inputtext);
- SendRconCommand(string);
- }
- case 5:
- {
- format(string, sizeof(string),"weather %s",inputtext);
- SendRconCommand(string);
- }
- case 6:
- {
- format(string, sizeof(string),"gravity %s",inputtext);
- SendRconCommand(string);
- }
- case 7:
- {
- format(string, sizeof(string),"rcon_password %s",inputtext);
- SendRconCommand(string);
- }
- case 8:
- {
- format(string, sizeof(string),"weburl %s",inputtext);
- SendRconCommand(string);
- }
- case 9:
- {
- format(string, sizeof(string),"loadfs %s",inputtext);
- SendRconCommand(string);
- }
- case 10:
- {
- format(string, sizeof(string),"unloadfs %s",inputtext);
- SendRconCommand(string);
- }
- case 11:
- {
- format(string, sizeof(string),"reloadfs %s",inputtext);
- SendRconCommand(string);
- }
- case 12:
- {
- format(string, sizeof(string),"kick %s",inputtext);
- SendRconCommand(string);
- }
- case 13:
- {
- format(string, sizeof(string),"ban %s",inputtext);
- SendRconCommand(string);
- }
- case 14:
- {
- format(string, sizeof(string),"banip %s",inputtext);
- SendRconCommand(string);
- }
- case 15:
- {
- format(string, sizeof(string),"unbanip %s",inputtext);
- SendRconCommand(string);
- }
- case 16:
- {
- format(string, sizeof(string),"language %s",inputtext);
- SendRconCommand(string);
- }
- case 17:
- {
- format(string, sizeof(string),"mapname %s",inputtext);
- SendRconCommand(string);
- }
- }
- return 1;
- }
- return 0;
- }
- /*==============================================
- COMMANDS
- ================================================*/
- CMD:trcon(playerid,params[])
- {
- new finalstring[300];
- if(TrcAdmin[playerid] == false) return 0;
- strcat(finalstring,"GMX(restart server)\nReload Bans\nShut Down(server)\nHostName(change hostname)\nSay(talk as admin)\nPassword(change/make/remove server password)\nGameMode Text\nWeather\nGravity\nRCON password(NOT T-RCON)\nWeb Url");
- strcat(finalstring, "\nMap Name\nLoadfs\nUnloadfs\nReloadfs\nReload Log\nKick\nBan\nBan Ip\nUn-ban ip");
- #if USE_03zR2_Above == true
- strcat(finalstring,"\nLanguage");//more to be added in the next version
- #endif
- ShowPlayerDialog(playerid,DIALOG_TRCON, DIALOG_STYLE_LIST, "T-RCON",finalstring, "Select", "Close");
- return 1;
- }
- CMD:trclogin(playerid,params[])
- {
- if(TrcAdmin[playerid] == true) return SendClientMessage(playerid, -1, "{00FF00}ERROR: {FFFF00}You are already a logged in. You can use /trcon");
- ShowPlayerDialog(playerid,DIALOG_TRCON_LOGIN,DIALOG_STYLE_PASSWORD ,"T-RCON Login", "Please enter the T-RCON password\nto use T-RCON","Confirm", "Exit");
- return 1;
- }
- /*==============================================
- FUNCTIONS
- ================================================*/
- stock ResetVariables(playerid)
- {
- TrcAdmin[playerid] = false;
- inputdialog[playerid] = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement