Advertisement
Guest User

RconPanel

a guest
Oct 30th, 2012
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define DIALOG_MAIN 1
  5. #define DIALOG_ECHO 2
  6. #define DIALOG_HOSTNAME 3
  7. #define DIALOG_GAMEMODETEXT 4
  8. #define DIALOG_MAPNAME 5
  9. #define DIALOG_EXECUTE 6
  10. #define DIALOG_CHANGEMODE 7
  11. #define DIALOG_SECOND 8
  12. #define DIALOG_SAY 9
  13. #define DIALOG_BANIP 10
  14. #define DIALOG_UNBANIP 11
  15. #define DIALOG_LOADFS 12
  16. #define DIALOG_UNLOADFS 13
  17.  
  18. CMD:panel(playerid,params[])
  19. {
  20. if(!IsPlayerAdmin(playerid)) return 0;
  21. ShowPlayerDialog(playerid,DIALOG_MAIN,DIALOG_STYLE_LIST,"Rcon Panel","Exit\nEcho\nHostName\nGameModeText\nMapName\nExecute\nChangemode","Select","Next");
  22. return 1;
  23. }
  24.  
  25. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  26. {
  27. if(dialogid == DIALOG_CHANGEMODE)
  28. {
  29. if(!response) return 0;
  30. new pName[MAX_PLAYER_NAME],string[124],Command[124];
  31. GetPlayerName(playerid,pName,sizeof(pName));
  32. format(string,sizeof(string),"Administrator %s changed the mode to %s",pName,inputtext);
  33. format(Command,sizeof(Command),"changemode %s",inputtext);
  34. SendRconCommand(Command);
  35. }
  36. if(dialogid == DIALOG_ECHO)
  37. {
  38. if(!response) return 0;
  39. new pName[MAX_PLAYER_NAME],string[124],Command[124];
  40. GetPlayerName(playerid,pName,sizeof(pName));
  41. format(string,sizeof(string),"Administrator %s: %s",pName,inputtext);
  42. format(Command,sizeof(Command),"echo %s",string);
  43. SendRconCommand(Command);
  44. }
  45. if(dialogid == DIALOG_MAPNAME)
  46. {
  47. if(!response) return 0;
  48. new command[64],string[124];
  49. format(command,sizeof(command),"mapname %s",inputtext);
  50. SendRconCommand(command);
  51. format(string,sizeof(string),"Mapname changed to %s",inputtext);
  52. SendClientMessage(playerid,-1,string);
  53. }
  54. if(dialogid == DIALOG_GAMEMODETEXT)
  55. {
  56. if(!response) return 0;
  57. new command[64],string[124];
  58. format(command,sizeof(command),"gamemodetext %s",inputtext);
  59. SendRconCommand(command);
  60. format(string,sizeof(string),"GameModeText changed to %s",inputtext);
  61. SendClientMessage(playerid,-1,string);
  62. }
  63. if(dialogid == DIALOG_HOSTNAME)
  64. {
  65. if(!response) return 0;
  66. new command[64],string[124];
  67. format(command,sizeof(command),"hostname %s",inputtext);
  68. SendRconCommand(command);
  69. format(string,sizeof(string),"Hostname changed to %s",inputtext);
  70. SendClientMessage(playerid,-1,string);
  71. }
  72. if(dialogid == DIALOG_EXECUTE)
  73. {
  74. if(!response) return 0;
  75. new command[64],string[124];
  76. format(command,sizeof(command),"exec %s",inputtext);
  77. SendRconCommand(command);
  78. format(string,sizeof(string),"%s has been executed.",inputtext);
  79. SendClientMessage(playerid,-1,string);
  80. }
  81. if(dialogid == DIALOG_SECOND)
  82. {
  83. if(!response) return 0;
  84. if(listitem == 0)
  85. {
  86. new pName[MAX_PLAYER_NAME],string[124];
  87. GetPlayerName(playerid,pName,sizeof(pName));
  88. format(string,sizeof(string),"Administrator %s restarted the server",pName);
  89. SendClientMessageToAll(-1,string);
  90. SendRconCommand("gmx");
  91. }
  92. if(listitem == 1)
  93. {
  94. SendClientMessage(playerid,-1,"Bans reloaded.");
  95. SendRconCommand("reloadbans");
  96. }
  97. if(listitem == 2)
  98. {
  99. SendClientMessage(playerid,-1,"Log reloaded.");
  100. SendRconCommand("reloadlogs");
  101. }
  102. if(listitem == 3)
  103. {
  104. ShowPlayerDialog(playerid,DIALOG_SAY,DIALOG_STYLE_INPUT,"Say","Please input the text to say","Say","Close");
  105. }
  106. if(listitem == 4)
  107. {
  108. SendRconCommand("players");
  109. }
  110. if(listitem == 5)
  111. {
  112. ShowPlayerDialog(playerid,DIALOG_BANIP,DIALOG_STYLE_INPUT,"BanIP","Input the IP to ban","Ban","Close");
  113. }
  114. if(listitem == 6)
  115. {
  116. ShowPlayerDialog(playerid,DIALOG_UNBANIP,DIALOG_STYLE_INPUT,"UnbanIP","Input the IP to unban","Unban","Close");
  117. }
  118. if(listitem == 7)
  119. {
  120. ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Loadfs","Input the fs to load","Load","Close");
  121. }
  122. if(listitem == 8)
  123. {
  124. ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Unloadfs","Input the fs to unload","Unload","Close");
  125. }
  126. }
  127. if(dialogid == DIALOG_LOADFS)
  128. {
  129. if(!response) return 0;
  130. new command[64];
  131. format(command,sizeof(command),"loadfs %s",inputtext);
  132. SendRconCommand(command);
  133. }
  134. if(dialogid == DIALOG_UNLOADFS)
  135. {
  136. if(!response) return 0;
  137. new command[64];
  138. format(command,sizeof(command),"unloadfs %s",inputtext);
  139. SendRconCommand(command);
  140. }
  141. if(dialogid == DIALOG_BANIP)
  142. {
  143. if(!response) return 0;
  144. new command[64],string[124];
  145. format(command,sizeof(command),"banip %s",inputtext);
  146. SendRconCommand(command);
  147. format(string,sizeof(string),"%s has been banned.",inputtext);
  148. SendClientMessage(playerid,-1,string);
  149. }
  150. if(dialogid == DIALOG_UNBANIP)
  151. {
  152. if(!response) return 0;
  153. new command[64],string[124];
  154. format(command,sizeof(command),"unbanip %s",inputtext);
  155. SendRconCommand(command);
  156. format(string,sizeof(string),"%s has been unbanned.",inputtext);
  157. SendClientMessage(playerid,-1,string);
  158. }
  159. if(dialogid == DIALOG_SAY)
  160. {
  161. if(!response) return 0;
  162. new command[64],string[124];
  163. format(command,sizeof(command),"say %s",inputtext);
  164. SendRconCommand(command);
  165. format(string,sizeof(string),"%s has been said.",inputtext);
  166. SendClientMessage(playerid,-1,string);
  167. }
  168. if(dialogid == DIALOG_MAIN)
  169. {
  170. if(!response) return ShowPlayerDialog(playerid,DIALOG_SECOND,DIALOG_STYLE_LIST,"Rcon Panel","Gmx\nReloadbans\nReloadlog\nSay\nPlayers\nbanip\nunbanip\nloadfs\nunloadfs","Select","Close");
  171. if(listitem == 0)
  172. {
  173. new pName[MAX_PLAYER_NAME],string[124];
  174. GetPlayerName(playerid,pName,sizeof(pName));
  175. format(string,sizeof(string),"Administrator %s has closed the server.",pName);
  176. SendClientMessageToAll(-1,string);
  177. SendRconCommand("exit");
  178. }
  179. if(listitem == 1)
  180. {
  181. ShowPlayerDialog(playerid,DIALOG_ECHO,DIALOG_STYLE_INPUT,"Echo","Input text to echo.","Echo","Close");
  182. }
  183. if(listitem == 2)
  184. {
  185. ShowPlayerDialog(playerid,DIALOG_HOSTNAME,DIALOG_STYLE_INPUT,"HostName","Input text to set the hostname.","Set","Close");
  186. }
  187. if(listitem == 3)
  188. {
  189. ShowPlayerDialog(playerid,DIALOG_GAMEMODETEXT,DIALOG_STYLE_INPUT,"GameModeText","Input the text you want to set as the gamemodetext","Set","Close");
  190. }
  191. if(listitem == 4)
  192. {
  193. ShowPlayerDialog(playerid,DIALOG_MAPNAME,DIALOG_STYLE_INPUT,"MapName","Input the text you want to set as the map name","Set","Close");
  194. }
  195. if(listitem == 5)
  196. {
  197. ShowPlayerDialog(playerid,DIALOG_EXECUTE,DIALOG_STYLE_INPUT,"Execute","Input the .cfg file you want to execute","Execute","Exit");
  198. }
  199. if(listitem == 6)
  200. {
  201. ShowPlayerDialog(playerid,DIALOG_CHANGEMODE,DIALOG_STYLE_INPUT,"Changemode","Input the gamemode you want to change too","Changemode","Close");
  202. }
  203. }
  204. return 1;
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement