Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===============================*INCLUDES*===================================//
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <rLogs>
- //==============================*DEFINATIONS*=================================//
- #define FILTERSCRIPT
- #define DIALOG_SETTINGS 999
- //================================*COLORS*====================================//
- #define RED 0xFF0000C8
- //===============================*VARIABLES*==================================//
- new DialogHostname = 1000;
- new DialogGamemode = 1001;
- new DialogMapname = 1002;
- new DialogWeburl = 1003;
- new DialogRconpass = 1004;
- new DialogReset = 1005;
- //================================*STOCKS*====================================//
- stock GetName(playerid)
- {
- new
- name[24];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- //===============================*COMMANDS*===================================//
- CMD:settings(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, RED, "[SERVER]: {FFFFFF}You need to be {FF0000}Admin{FFFFFF}, to use this command !");
- ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- return 1;
- }
- //===============================*CALLBACK*===================================//
- public OnFilterScriptInit()
- {
- print(">> In-Game Settings Script by Areax has been loaded ! <<");
- return 1;
- }
- //============================================================================//
- public OnFilterScriptExit()
- {
- print(">> In-Game Settings Script by Areax has been unloaded ! <<");
- return 1;
- }
- //============================================================================//
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_SETTINGS)
- {
- if(!response)return 0;
- if(response)
- {
- if(listitem == 0)return ShowPlayerDialog(playerid, DialogHostname, DIALOG_STYLE_INPUT, "Change {FF0000}HostName", "Enter new Hostname:", "Enter", "Back");
- if(listitem == 1)return ShowPlayerDialog(playerid, DialogGamemode, DIALOG_STYLE_INPUT, "Change {FF0000}GameMode", "Enter new Gamemode name:", "Enter", "Back");
- if(listitem == 2)return ShowPlayerDialog(playerid, DialogMapname, DIALOG_STYLE_INPUT, "Change {FF0000}MapName", "Enter new Mapname:", "Enter", "Back");
- if(listitem == 3)return ShowPlayerDialog(playerid, DialogWeburl, DIALOG_STYLE_INPUT, "Change {FF0000}Web URL", "Enter new Web URL:", "Enter", "Back");
- if(listitem == 4)return ShowPlayerDialog(playerid, DialogRconpass, DIALOG_STYLE_INPUT, "Change {FF0000}RCON Password", "Enter new RCON Password:", "Enter", "Back");
- if(listitem == 5)return ShowPlayerDialog(playerid, DialogReset, DIALOG_STYLE_MSGBOX, "Reset {FF0000}Server", "Do you really want to restart server ?", "Yes", "No");
- }
- }
- if(dialogid == DialogReset)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- SendRconCommand("gmx");
- GameTextForAll("~g~Server ~w~is ~r~restarting~w~, ~w~Please, wait...", 5000, 5);
- WriteInLog("IGS/Logs/ResetServer.log", "", "%s has Reseted the Server", GetName(playerid));
- }
- }
- if(dialogid == DialogHostname)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- new Hostname[100]; new string[150];
- format(Hostname, sizeof(Hostname), "hostname %s", inputtext);
- SendRconCommand(Hostname);
- format(string, sizeof(string), "~g~Hostname ~w~has been changed to: ~b~%s", inputtext);
- GameTextForPlayer(playerid, string, 4000, 5);
- WriteInLog("IGS/Logs/ChangeHostname.log", "", "%s has changed the Hostname to: %s", GetName(playerid), inputtext);
- }
- }
- if(dialogid == DialogGamemode)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- new Gamemode[100]; new string[150];
- format(Gamemode, sizeof(Gamemode), "gamemodetext %s", inputtext);
- SendRconCommand(Gamemode);
- format(string, sizeof(string), "~g~Gamemode Text ~w~has been changed to: ~b~%s", inputtext);
- GameTextForPlayer(playerid, string, 4000, 5);
- WriteInLog("IGS/Logs/ChangeGamemodetext.log", "", "%s has changed the Gamemode Text to: %s", GetName(playerid), inputtext);
- }
- }
- if(dialogid == DialogMapname)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- new Mapname[100]; new string[150];
- format(Mapname, sizeof(Mapname), "mapname %s", inputtext);
- SendRconCommand(Mapname);
- format(string, sizeof(string), "~g~Mapname ~w~has been changed to: ~b~%s", inputtext);
- GameTextForPlayer(playerid, string, 4000, 5);
- WriteInLog("IGS/Logs/ChangeMapname.log", "", "%s has changed the Mapname to: %s", GetName(playerid), inputtext);
- }
- }
- if(dialogid == DialogWeburl)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- new Weburl[150]; new string[150];
- format(Weburl, sizeof(Weburl), "weburl %s", inputtext);
- SendRconCommand(Weburl);
- format(string, sizeof(string), "~g~Web URL ~w~has been changed to: ~b~%s", inputtext);
- GameTextForPlayer(playerid, string, 4000, 5);
- WriteInLog("IGS/Logs/ChangeWeburl.log", "", "%s has changed the Web URL to: %s", GetName(playerid), inputtext);
- }
- }
- if(dialogid == DialogRconpass)
- {
- if(!response)return ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Server Settings", "{FF0000}1. {FFFFFF}- Change Hostname\n{FF0000}2. {FFFFFF}- Change Gamemode Text\n{FF0000}3. {FFFFFF}- Change Mapname\n{FF0000}4. {FFFFFF}- Change Web URL\n{FF0000}5. {FFFFFF}- Change RCON Password\n{FF0000}6. {FFFFFF}- Restart Server", "Continue", "Close");
- if(response)
- {
- new Rconpass[50]; new string[150];
- format(Rconpass, sizeof(Rconpass), "rcon_password %s", inputtext);
- SendRconCommand(Rconpass);
- format(string, sizeof(string), "~g~RCON Password ~w~has been changed to: ~b~%s", inputtext);
- GameTextForPlayer(playerid, string, 4000, 5);
- WriteInLog("IGS/Logs/ChangeRconpass.log", "", "%s has changed the RCON password to: %s", GetName(playerid), inputtext);
- }
- }
- return 1;
- }
- //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement