Advertisement
Guest User

IGS

a guest
Dec 1st, 2013
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.92 KB | None | 0 0
  1. //===============================*INCLUDES*===================================//
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. #include <rLogs>
  6. //==============================*DEFINATIONS*=================================//
  7. #define FILTERSCRIPT
  8. #define DIALOG_SETTINGS      999
  9. //================================*COLORS*====================================//
  10. #define RED         0xFF0000C8
  11. //===============================*VARIABLES*==================================//
  12. new DialogHostname = 1000;
  13. new DialogGamemode = 1001;
  14. new DialogMapname = 1002;
  15. new DialogWeburl = 1003;
  16. new DialogRconpass = 1004;
  17. new DialogReset = 1005;
  18. //================================*STOCKS*====================================//
  19. stock GetName(playerid)
  20. {
  21.     new
  22.     name[24];
  23.     GetPlayerName(playerid, name, sizeof(name));
  24.     return name;
  25. }
  26. //===============================*COMMANDS*===================================//
  27. CMD:settings(playerid, params[])
  28. {
  29.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, RED, "[SERVER]: {FFFFFF}You need to be {FF0000}Admin{FFFFFF}, to use this command !");
  30.     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");
  31.     return 1;
  32. }
  33. //===============================*CALLBACK*===================================//
  34. public OnFilterScriptInit()
  35. {
  36.     print(">> In-Game Settings Script by Areax has been loaded ! <<");
  37.     return 1;
  38. }
  39. //============================================================================//
  40. public OnFilterScriptExit()
  41. {
  42.     print(">> In-Game Settings Script by Areax has been unloaded ! <<");
  43.     return 1;
  44. }
  45. //============================================================================//
  46. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  47. {
  48.     if(dialogid == DIALOG_SETTINGS)
  49.     {
  50.     if(!response)return 0;
  51.     if(response)
  52.     {
  53.     if(listitem == 0)return ShowPlayerDialog(playerid, DialogHostname, DIALOG_STYLE_INPUT, "Change {FF0000}HostName", "Enter new Hostname:", "Enter", "Back");
  54.     if(listitem == 1)return ShowPlayerDialog(playerid, DialogGamemode, DIALOG_STYLE_INPUT, "Change {FF0000}GameMode", "Enter new Gamemode name:", "Enter", "Back");
  55.     if(listitem == 2)return ShowPlayerDialog(playerid, DialogMapname, DIALOG_STYLE_INPUT, "Change {FF0000}MapName", "Enter new Mapname:", "Enter", "Back");
  56.     if(listitem == 3)return ShowPlayerDialog(playerid, DialogWeburl, DIALOG_STYLE_INPUT, "Change {FF0000}Web URL", "Enter new Web URL:", "Enter", "Back");
  57.     if(listitem == 4)return ShowPlayerDialog(playerid, DialogRconpass, DIALOG_STYLE_INPUT, "Change {FF0000}RCON Password", "Enter new RCON Password:", "Enter", "Back");
  58.     if(listitem == 5)return ShowPlayerDialog(playerid, DialogReset, DIALOG_STYLE_MSGBOX, "Reset {FF0000}Server", "Do you really want to restart server ?", "Yes", "No");
  59.     }
  60.     }
  61.     if(dialogid == DialogReset)
  62.     {
  63.     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");
  64.     if(response)
  65.     {
  66.     SendRconCommand("gmx");
  67.     GameTextForAll("~g~Server ~w~is ~r~restarting~w~, ~w~Please, wait...", 5000, 5);
  68.     WriteInLog("IGS/Logs/ResetServer.log", "", "%s has Reseted the Server", GetName(playerid));
  69.     }
  70.     }
  71.     if(dialogid == DialogHostname)
  72.     {
  73.     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");
  74.     if(response)
  75.     {
  76.     new Hostname[100]; new string[150];
  77.     format(Hostname, sizeof(Hostname), "hostname %s", inputtext);
  78.     SendRconCommand(Hostname);
  79.     format(string, sizeof(string), "~g~Hostname ~w~has been changed to: ~b~%s", inputtext);
  80.     GameTextForPlayer(playerid, string, 4000, 5);
  81.     WriteInLog("IGS/Logs/ChangeHostname.log", "", "%s has changed the Hostname to: %s", GetName(playerid), inputtext);
  82.     }
  83.     }
  84.     if(dialogid == DialogGamemode)
  85.     {
  86.     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");
  87.     if(response)
  88.     {
  89.     new Gamemode[100]; new string[150];
  90.     format(Gamemode, sizeof(Gamemode), "gamemodetext %s", inputtext);
  91.     SendRconCommand(Gamemode);
  92.     format(string, sizeof(string), "~g~Gamemode Text ~w~has been changed to: ~b~%s", inputtext);
  93.     GameTextForPlayer(playerid, string, 4000, 5);
  94.     WriteInLog("IGS/Logs/ChangeGamemodetext.log", "", "%s has changed the Gamemode Text to: %s", GetName(playerid), inputtext);
  95.     }
  96.     }
  97.     if(dialogid == DialogMapname)
  98.     {
  99.     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");
  100.     if(response)
  101.     {
  102.     new Mapname[100]; new string[150];
  103.     format(Mapname, sizeof(Mapname), "mapname %s", inputtext);
  104.     SendRconCommand(Mapname);
  105.     format(string, sizeof(string), "~g~Mapname ~w~has been changed to: ~b~%s", inputtext);
  106.     GameTextForPlayer(playerid, string, 4000, 5);
  107.     WriteInLog("IGS/Logs/ChangeMapname.log", "", "%s has changed the Mapname to: %s", GetName(playerid), inputtext);
  108.     }
  109.     }
  110.     if(dialogid == DialogWeburl)
  111.     {
  112.     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");
  113.     if(response)
  114.     {
  115.     new Weburl[150]; new string[150];
  116.     format(Weburl, sizeof(Weburl), "weburl %s", inputtext);
  117.     SendRconCommand(Weburl);
  118.     format(string, sizeof(string), "~g~Web URL ~w~has been changed to: ~b~%s", inputtext);
  119.     GameTextForPlayer(playerid, string, 4000, 5);
  120.     WriteInLog("IGS/Logs/ChangeWeburl.log", "", "%s has changed the Web URL to: %s", GetName(playerid), inputtext);
  121.     }
  122.     }
  123.     if(dialogid == DialogRconpass)
  124.     {
  125.     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");
  126.     if(response)
  127.     {
  128.     new Rconpass[50]; new string[150];
  129.     format(Rconpass, sizeof(Rconpass), "rcon_password %s", inputtext);
  130.     SendRconCommand(Rconpass);
  131.     format(string, sizeof(string), "~g~RCON Password ~w~has been changed to: ~b~%s", inputtext);
  132.     GameTextForPlayer(playerid, string, 4000, 5);
  133.     WriteInLog("IGS/Logs/ChangeRconpass.log", "", "%s has changed the RCON password to: %s", GetName(playerid), inputtext);
  134.     }
  135.     }
  136.     return 1;
  137. }
  138. //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement