View difference between Paste ID: c1b8BjyJ and k9Sem5Ry
SHOW: | | - or go back to the newest paste.
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"
13+
14
#define SendErrorMessage(%0,%1) \
15
	SCM(%0, -1, "{FF0000}[ ERROR ]: {FFFFFF} "%1)
16
	
17
#define SendInfoMessage(%0,%1) \
18
	SCM(%0, -1, "{007799}[ INFO ]: {FFFFFF} "%1)
19
20
// == [ DIALOG ] == ////////////////////////////////////////////////////////////
21
22
#define dialog_SERVERPANEL                                                  1000
23
#define dialog_SERVERNAME                                                   1001
24
#define dialog_SERVERPW                                                     1002
25
#define dialog_SERVERMAP                                                    1003
26
#define dialog_SERVERRCONPW                                                 1004
27
#define dialog_SERVERURL                                                    1005
28
#define dialog_SERVERMODE                                                   1006
29
30
// == [ PUBLIC ] == ////////////////////////////////////////////////////////////
31
32
33
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
34
{
35
	if( dialogid == dialog_SERVERPANEL )
36
 	{
37
 	    if( response )
38
 	    {
39
 			if( listitem == 0 )
40
			{
41
			    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" );
42
			}
43
			if( listitem == 1 )
44
			{
45
			    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" );
46
			  }
47
			if( listitem == 2 )
48
			{
49
			    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" );
50
			}
51
			if( listitem == 3 )
52
			{
53
			    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" );
54
			}
55
			if( listitem == 4 )
56
			{
57
			    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" );
58
			}
59
			if( listitem == 5 )
60
			{
61
				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" );
62
			}
63
		}
64
	}
65
	if( dialogid == dialog_SERVERNAME )
66
	{
67
	    new namestring[256];
68
	    if( response )
69
	    {
70
     		format( namestring, sizeof( namestring ), "hostname %s", inputtext );
71
	        SendRconCommand( namestring );
72
	        SendInfoMessage( playerid, "Uspesno ste promenili ime servera!" );
73
		}
74
	}
75
	if( dialogid == dialog_SERVERPW )
76
	{
77
	    new passwordstring[256];
78
	    if( response )
79
	    {
80
     		format( passwordstring, sizeof( passwordstring ), "password %s", inputtext );
81
	        SendRconCommand( passwordstring );
82
	        SendInfoMessage( playerid, "Uspesno ste promenili sifru servera!" );
83
		}
84
	}
85
	if( dialogid == dialog_SERVERMAP )
86
	{
87
	    new mapstring[256];
88
	    if( response )
89
	    {
90
     		format( mapstring, sizeof( mapstring ), "mapname %s", inputtext );
91
	        SendRconCommand( mapstring );
92
	        SendInfoMessage( playerid, "Uspesno ste promenili mapu servera!" );
93
		}
94
	}
95
	if( dialogid == dialog_SERVERRCONPW )
96
	{
97
	    new rconpwstring[256];
98
	    if( response )
99
	    {
100
     		format( rconpwstring, sizeof( rconpwstring ), "rcon_password %s", inputtext );
101
	        SendRconCommand( rconpwstring );
102
	        SendInfoMessage( playerid, "Uspesno ste promenili rcon password servera!" );
103
		}
104
	}
105
	if( dialogid == dialog_SERVERURL )
106
	{
107
	    new urlstring[256];
108
	    if( response )
109
	    {
110
     		format( urlstring, sizeof( urlstring ), "weburl %s", inputtext );
111
	        SendRconCommand( urlstring );
112
	        SendInfoMessage( playerid, "Uspesno ste promenili weburl servera!" );
113
		}
114
	}
115
	if( dialogid == dialog_SERVERMODE )
116
	{
117
	    new modestring[256];
118
	    if( response )
119
	    {
120
     		format( modestring, sizeof( modestring ), "%s", inputtext );
121
	        SetGameModeText( modestring );
122
	        SendInfoMessage( playerid, "Uspesno ste promenili gamemode text servera!" );
123
		}
124
	}
125
	return 1;
126
}
127
128
// == [ KOMANDE ] == ///////////////////////////////////////////////////////////
129
130
CMD:rconpanel( playerid, params[] )
131
{
132
	if( !IsPlayerAdmin( playerid ) )
133
	{
134
		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" );
135
	}
136
	else SendErrorMessage( playerid, "Morate biti RCON Admin kako bi ste mogli da koristite ovu komandu!");
137
	return 1;
138
}
139
140
// == [ KRAJ ] == //////////////////////////////////////////////////////////////