Guest User

S_RCP

a guest
Mar 13th, 2015
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.44 KB | None | 0 0
  1. // ___________________________________Rcon_Control_Panel________________________//
  2. // Creator: ScRipTerZ Aka Crazy_Sniper //
  3. // Date: 2015/03/01 //
  4. //______________________________________________________________________________//
  5. /* Note:
  6. / 1- Please if you are using it, add my name in credits
  7. / 2- You can't edit this filterscript without my permission
  8. / 3- Don't forget to rep me
  9. */
  10.  
  11. //===============Includes=======================================================//
  12. #include <a_samp> // Thanks to SA-MP Team
  13. #include <zcmd> // Thanks to Zeex
  14. //==============================================================================/
  15. //---------DIALOG-----------------------------------------------------------------------/
  16. #define DIALOG_SRCP 12520 // Note, if you already using this number you are free to edit.
  17. #define DIALOG_CHANGEURL 12521
  18. #define DIALOG_CHANGEHOSTNAME 12522
  19. #define DIALOG_CHANGERCONPASS 12523
  20. #define DIALOG_CHANGEMAPNAME 12524
  21. #define DIALOG_LOADFS 12525
  22. #define DIALOG_UNLOADFS 12526
  23. #define DIALOG_RESTART 12527
  24. #define DIALOG_CHANGEGRAVITY 12528
  25. #define DIALOG_CHANGEMODE 12529
  26. #define DIALOG_RCONPASS 12530
  27. #define DIALOG_RELOAD 12531
  28. //---------------------------------------------------------------------------------------/
  29.  
  30. #if defined FILTERSCRIPT
  31.  
  32. public OnFilterScriptInit()
  33. {
  34. print("\n--------------------------------------");
  35. print(" - ScRipTerZ _ Rcon Control Panel -");
  36. print(" - Loaded -");
  37. print("--------------------------------------\n");
  38. return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43. print("\n--------------------------------------");
  44. print(" - ScRipTerZ _ Rcon Control Panel -");
  45. print(" - Unloaded -");
  46. print("--------------------------------------\n");
  47. return 1;
  48. }
  49.  
  50. #endif
  51.  
  52. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  53. {
  54. switch( dialogid )
  55. {
  56. case DIALOG_SRCP:
  57. {
  58. if(response)
  59. {
  60. if(listitem == 0)
  61. {
  62. ShowPlayerDialog(playerid,DIALOG_CHANGEHOSTNAME,DIALOG_STYLE_INPUT,"Hostname","Write new hostname below","Done","");
  63. return 1;
  64. }
  65. if(listitem == 1)
  66. {
  67. ShowPlayerDialog(playerid,DIALOG_CHANGEURL,DIALOG_STYLE_INPUT,"Weburl","Change weburl below","Done","Cancel");
  68. return 1;
  69. }
  70. if(listitem == 2)
  71. {
  72. ShowPlayerDialog(playerid,DIALOG_CHANGEGRAVITY,DIALOG_STYLE_INPUT,"Gravity","Change gravity below","Done","Cancel");
  73. return 1;
  74. }
  75. if(listitem == 3)
  76. {
  77. ShowPlayerDialog(playerid,DIALOG_RESTART,DIALOG_STYLE_MSGBOX,"Restart","Are you sure to restart the server?","Yes","No");
  78. return 1;
  79. }
  80. if(listitem == 4)
  81. {
  82. ShowPlayerDialog(playerid,DIALOG_CHANGEMODE,DIALOG_STYLE_INPUT,"Changemode","Write below, new gamemode you want to load\nExample: grandlarc.amx","Done","Cancel");
  83. return 1;
  84. }
  85. if(listitem == 5)
  86. {
  87. ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Load FilterScript","Write below, the filterscript name you want to load","Done","Cancel");
  88. return 1;
  89. }
  90. if(listitem == 6)
  91. {
  92. ShowPlayerDialog(playerid,DIALOG_UNLOADFS,DIALOG_STYLE_INPUT,"UnLoad FilterScript","Write below, the filterscript name you want to unload","Done","Cancel");
  93. return 1;
  94. }
  95. if(listitem == 7)
  96. {
  97. ShowPlayerDialog(playerid,DIALOG_RCONPASS,DIALOG_STYLE_INPUT,"Rcon password","Write below, new rcon password","Done","Cancel");
  98. return 1;
  99. }
  100. if(listitem == 8)
  101. {
  102. ShowPlayerDialog(playerid,DIALOG_RELOAD,DIALOG_STYLE_MSGBOX,"Reload Log/Bans","Which you want to reload?","Log","Bans");
  103. return 1;
  104. }
  105. }
  106. }
  107. }
  108. if(dialogid == DIALOG_CHANGEHOSTNAME)
  109. {
  110. if(response)
  111. {
  112. if(!inputtext[0])
  113. {
  114. ShowPlayerDialog(playerid,DIALOG_CHANGEHOSTNAME,DIALOG_STYLE_INPUT,"Hostname","Write new hostname below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  115. return 1;
  116. }
  117. else
  118. {
  119. new string[128];
  120. format(string, sizeof(string), "hostname %s", inputtext);
  121. SendRconCommand(string);
  122. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have change the hostname to %s",inputtext);
  123. SendClientMessage(playerid,-1,string);
  124. return 1;
  125. }
  126. }
  127. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload BanList","Click","Cancel");
  128. }
  129. if(dialogid == DIALOG_CHANGEURL)
  130. {
  131. if(response)
  132. {
  133. if(!inputtext[0])
  134. {
  135. ShowPlayerDialog(playerid,DIALOG_CHANGEURL,DIALOG_STYLE_INPUT,"Weburl","Write new website url below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  136. return 1;
  137. }
  138. else
  139. {
  140. new string[128];
  141. format(string, sizeof(string), "weburl %s", inputtext);
  142. SendRconCommand(string);
  143. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have change weburl to %s",inputtext);
  144. SendClientMessage(playerid,-1,string);
  145. return 1;
  146. }
  147. }
  148. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload BanList","Click","Cancel");
  149. }
  150. if(dialogid == DIALOG_CHANGEGRAVITY)
  151. {
  152. if(response)
  153. {
  154. if(!inputtext[0])
  155. {
  156. ShowPlayerDialog(playerid,DIALOG_CHANGEGRAVITY,DIALOG_STYLE_INPUT,"Gravity","Write new gravity below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  157. return 1;
  158. }
  159. else
  160. {
  161. new string[128];
  162. format(string, sizeof(string), "gravity %s", inputtext);
  163. SendRconCommand(string);
  164. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have change gravity to %s",inputtext);
  165. SendClientMessage(playerid,-1,string);
  166. return 1;
  167. }
  168. }
  169. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload BanList","Click","Cancel");
  170. }
  171. if(dialogid == DIALOG_RESTART)
  172. {
  173. if(response)
  174. {
  175. SendRconCommand("gmx");
  176. SendClientMessage(playerid,-1,"{00FF0A}Info: {FFFFFF}Restarting the server...");
  177. return 1;
  178. }
  179. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload BanList","Click","Cancel");
  180. }
  181. if(dialogid == DIALOG_CHANGEMODE)
  182. {
  183. if(response)
  184. {
  185. if(!inputtext[0])
  186. {
  187. ShowPlayerDialog(playerid,DIALOG_CHANGEMODE,DIALOG_STYLE_INPUT,"GameMode","Write new gamemode name below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  188. return 1;
  189. }
  190. else
  191. {
  192. new string[128];
  193. format(string, sizeof(string), "changemode %s", inputtext);
  194. SendRconCommand(string);
  195. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have changed gamemode to %s",inputtext);
  196. SendClientMessage(playerid,-1,string);
  197. return 1;
  198. }
  199. }
  200. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload BanList","Click","Cancel");
  201. }
  202. if(dialogid == DIALOG_LOADFS)
  203. {
  204. if(response)
  205. {
  206. if(!inputtext[0])
  207. {
  208. ShowPlayerDialog(playerid,DIALOG_LOADFS,DIALOG_STYLE_INPUT,"Load Filterscript","Write filterscript to load below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  209. return 1;
  210. }
  211. else
  212. {
  213. new string[128];
  214. format(string, sizeof(string), "loadfs %s", inputtext);
  215. SendRconCommand(string);
  216. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have loaded this FilterScript '%s'",inputtext);
  217. SendClientMessage(playerid,-1,string);
  218. return 1;
  219. }
  220. }
  221. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password","Click","Cancel");
  222. }
  223. if(dialogid == DIALOG_UNLOADFS)
  224. {
  225. if(response)
  226. {
  227. if(!inputtext[0])
  228. {
  229. ShowPlayerDialog(playerid,DIALOG_UNLOADFS,DIALOG_STYLE_INPUT,"UnLoad Filterscript","Write filterscript to unload below\n{FF0000}Error: {FFFFFF}Write again","Done","");
  230. return 1;
  231. }
  232. else
  233. {
  234. new string[128];
  235. format(string, sizeof(string), "unloadfs %s", inputtext);
  236. SendRconCommand(string);
  237. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have unloaded this FilterScript '%s'",inputtext);
  238. SendClientMessage(playerid,-1,string);
  239. return 1;
  240. }
  241. }
  242. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password","Click","Cancel");
  243. }
  244. if(dialogid == DIALOG_RCONPASS)
  245. {
  246. if(response)
  247. {
  248. if(!inputtext[0])
  249. {
  250. ShowPlayerDialog(playerid,DIALOG_UNLOADFS,DIALOG_STYLE_INPUT,"Rcon Password","Write below, new rcon password\n{FF0000}Error: {FFFFFF}Write again","Done","");
  251. return 1;
  252. }
  253. else
  254. {
  255. new string[128];
  256. format(string, sizeof(string), "rcon_password %s", inputtext);
  257. SendRconCommand(string);
  258. format(string, sizeof(string), "{00FF0A}Info: {FFFFFF}you have changed rcon password to '%s'",inputtext);
  259. SendClientMessage(playerid,-1,string);
  260. return 1;
  261. }
  262. }
  263. else ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password","Click","Cancel");
  264. }
  265. if(dialogid == DIALOG_RELOAD)
  266. {
  267. if(response)
  268. {
  269. SendRconCommand("reloadlog");
  270. SendClientMessage(playerid,-1,"{00FF0A}Info: {FFFFFF}you have successfully reloaded the server log");
  271. return 1;
  272. }
  273. else
  274. {
  275. SendRconCommand("reloadbans");
  276. SendClientMessage(playerid,-1,"{00FF0A}Info: {FFFFFF}you have successfully reloaded the bans list");
  277. }
  278. }
  279. return 1;
  280. }
  281.  
  282. CMD:srcp(playerid, params[])
  283. {
  284. if(IsPlayerAdmin(playerid))
  285. {
  286. ShowPlayerDialog(playerid,DIALOG_SRCP,DIALOG_STYLE_LIST,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ","{FF1400}Hostname\n{FF1400}Weburl\n{FF1400}Gravity\n{FF1400}Restart\n{FF1400}Change Mode\n{FF1400}Load FilterScript\n{FF1400}Unload FilterScript\n{FF1400}Rcon Password\n{FF1400}Reload Log/Bans","Click","Cancel");
  287. }
  288. return 1;
  289. }
  290.  
  291. CMD:srcphelp(playerid, params[])
  292. {
  293. if(!IsPlayerAdmin(playerid)) return 0;
  294. ShowPlayerDialog(playerid,9141,DIALOG_STYLE_MSGBOX,"{FFC800}Rcon Control Panel {FF0000}- {FF7800}By ScRipTerZ {FF0000}- {00FF0A}FAQS","{FF9600}How to use rcon control panel?\nEasy just write ( {FEFEFE}/srcp {FFFFFF}) and choose an option.\nif you found a bug please inform the author ( ScRipTerZ )","Ok","");
  295. return 1;
  296. }
  297. //===================================================================== END =================================================================//
Advertisement
Add Comment
Please, Sign In to add comment