Guest User

RconPanel by MaraneLLo

a guest
Nov 25th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. // == [ INCLUDES ] == //////////////////////////////////////////////////////////
  2.  
  3. #include < a_samp >
  4. #include < sscanf2 >
  5. #include < zcmd >
  6.  
  7. // == [ DEFINES ] == ///////////////////////////////////////////////////////////
  8.  
  9. #define SCM SendClientMessage
  10. #define SPD ShowPlayerDialog
  11. #define DSI DIALOG_STYLE_INPUT
  12. #define DSL DIALOG_STYLE_LIST
  13. #define MAX_RCON "50"
  14.  
  15. #define SendErrorMessage(%0,%1) \
  16. SCM(%0, -1, "{FF0000}[ ERROR ]: {FFFFFF} "%1)
  17.  
  18. #define SendInfoMessage(%0,%1) \
  19. SCM(%0, -1, "{007799}[ INFO ]: {FFFFFF} "%1)
  20.  
  21. // == [ DIALOG ] == ////////////////////////////////////////////////////////////
  22.  
  23. #define dialog_SERVERPANEL 1000
  24. #define dialog_SERVERNAME 1001
  25. #define dialog_SERVERPW 1002
  26. #define dialog_SERVERMAP 1003
  27. #define dialog_SERVERRCONPW 1004
  28. #define dialog_SERVERURL 1005
  29. #define dialog_SERVERMODE 1006
  30.  
  31. // == [ PUBLIC ] == ////////////////////////////////////////////////////////////
  32.  
  33.  
  34. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
  35. {
  36. if( dialogid == dialog_SERVERPANEL )
  37. {
  38. if( response )
  39. {
  40. if( listitem == 0 )
  41. {
  42. SPD( playerid, dialog_SERVERNAME, DSI, "{007799}- HOSTNAME SERVERA -","{007799}>{FFFFFF} Molimo da unesete novo ime servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  43. }
  44. if( listitem == 1 )
  45. {
  46. SPD( playerid, dialog_SERVERPW, DSI, "{007799}- PASSWORD SERVERA -","{007799}>{FFFFFF} Molimo da unesete novu sifru servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  47. }
  48. if( listitem == 2 )
  49. {
  50. SPD( playerid, dialog_SERVERMAP, DSI, "{007799}- MAPA SERVERA -","{007799}>{FFFFFF} Molimo da unesete novi weburl servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  51. }
  52. if( listitem == 3 )
  53. {
  54. SPD( playerid, dialog_SERVERRCONPW, DSI, "{007799}- RCON PASSWORD SERVERA -","{007799}>{FFFFFF} Molimo da unesete novi rcon password servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  55. }
  56. if( listitem == 4 )
  57. {
  58. SPD( playerid, dialog_SERVERURL, DSI, "{007799}- WEBURL SERVERA -","{007799}>{FFFFFF} Molimo da unesete novi weburl servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  59. }
  60. if( listitem == 5 )
  61. {
  62. SPD( playerid, dialog_SERVERMODE, DSI, "{007799}- GAMEMODE SERVERA -","{007799}>{FFFFFF} Molimo da unesete novi gamemode text servera\n{007799}>{FFFFFF} Molimo da pazljivo proverite pre promene","ODABERI","ODUSTANI" );
  63. }
  64. }
  65. }
  66. if( dialogid == dialog_SERVERNAME )
  67. {
  68. new namestring[256];
  69. if( response )
  70. {
  71. format( namestring, sizeof( namestring ), "hostname %s", inputtext );
  72. SendRconCommand( namestring );
  73. SendInfoMessage( playerid, "Uspesno ste promenili ime servera!" );
  74. }
  75. }
  76. if( dialogid == dialog_SERVERPW )
  77. {
  78. new passwordstring[256];
  79. if( response )
  80. {
  81. format( passwordstring, sizeof( passwordstring ), "password %s", inputtext );
  82. SendRconCommand( passwordstring );
  83. SendInfoMessage( playerid, "Uspesno ste promenili sifru servera!" );
  84. }
  85. }
  86. if( dialogid == dialog_SERVERMAP )
  87. {
  88. new mapstring[256];
  89. if( response )
  90. {
  91. format( mapstring, sizeof( mapstring ), "mapname %s", inputtext );
  92. SendRconCommand( mapstring );
  93. SendInfoMessage( playerid, "Uspesno ste promenili mapu servera!" );
  94. }
  95. }
  96. if( dialogid == dialog_SERVERRCONPW )
  97. {
  98. new rconpwstring[256];
  99. if( response )
  100. {
  101. format( rconpwstring, sizeof( rconpwstring ), "rcon_password %s", inputtext );
  102. SendRconCommand( rconpwstring );
  103. SendInfoMessage( playerid, "Uspesno ste promenili rcon password servera!" );
  104. }
  105. }
  106. if( dialogid == dialog_SERVERURL )
  107. {
  108. new urlstring[256];
  109. if( response )
  110. {
  111. format( urlstring, sizeof( urlstring ), "weburl %s", inputtext );
  112. SendRconCommand( urlstring );
  113. SendInfoMessage( playerid, "Uspesno ste promenili weburl servera!" );
  114. }
  115. }
  116. if( dialogid == dialog_SERVERMODE )
  117. {
  118. new modestring[256];
  119. if( response )
  120. {
  121. format( modestring, sizeof( modestring ), "%s", inputtext );
  122. SetGameModeText( modestring );
  123. SendInfoMessage( playerid, "Uspesno ste promenili gamemode text servera!" );
  124. }
  125. }
  126. return 1;
  127. }
  128.  
  129. // == [ KOMANDE ] == ///////////////////////////////////////////////////////////
  130.  
  131. CMD:rconpanel( playerid, params[] )
  132. {
  133. if( !IsPlayerAdmin( playerid ) )
  134. {
  135. SPD( playerid, dialog_SERVERPANEL, DSL, "{007799}- SERVER RCON PANEL -", "{007799}>{FFFFFF} HOSTNAME\n{007799}>{FFFFFF} PASSWORD\n{007799}>{FFFFFF} MAPNAME\n{007799}>{FFFFFF} RCON PASSWORD\n{007799}>{FFFFFF} WEB URL\n{007799}>{FFFFFF} GAMEMODE TEXT", "ODABERI", "ODUSTANI" );
  136. }
  137. else SendErrorMessage( playerid, "Morate biti RCON Admin kako bi ste mogli da koristite ovu komandu!");
  138. return 1;
  139. }
  140.  
  141. // == [ KRAJ ] == //////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment