-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTS-Controller.pwn
346 lines (287 loc) · 9.03 KB
/
TS-Controller.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
//------------#NimA00GaMeR---------------------------------------------------------------------------------
//------------NNN----------------NN---------0000000000000-----0000000000000-----GGGGGGGGGGGGGGGGGGGGGGGG---
//------------NN-NN--------------NN--------00-----------00---00-----------00----GG-------------------------
//------------NN--NN-------------NN-------00-------------00-00-------------00---GG-------------------------
//------------NN---NN------------NN-------00-------------00-00-------------00---GG-------------------------
//------------NN----NN-----------NN-------00-------------00-00-------------00---GG-------------------------
//------------NN-----NN----------NN-------00-------------00-00-------------00---GG-------------------------
//------------NN------NN---------NN-------00-------------00-00-------------00---GG-------------------------
//------------NN-------NN--------NN-------00-------------00-00-------------00---GG-----GGGGGGGGGGGGGGGGG---
//------------NN--------NN-------NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN---------NN------NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN----------NN-----NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN-----------NN----NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN------------NN---NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN-------------NN--NN-------00-------------00-00-------------00---GG--------------------GG---
//------------NN--------------NN-NN--------00-----------00---00-----------00----GG--------------------GG---
//------------NN---------------NNN-----------000000000000-----000000000000------GGGGGGGGGGGGGGGGGGGGGGGG---
//---------------------------------------------------------------------------------------------------------
//----------------------------------THIS FILTERSCRIPT MADE BY:NIMA00GAMER----------------------------------
//----------------------------------------TeamSpeak Controller V1.0----------------------------------------
#include <a_samp>
#include <TSConnector>
#define TS_IP "127.0.0.1" // IP Of TeamSpeak Server
#define TS_PORT 9987 // Port Of TeamSpeak Server
#define TS_QUESER "serveradmin" // Query's User Of TeamSpeak Server
#define TS_QPASS "5lrviiGI" // Query's Password TeamSpeak Server
#define RANK_STATUS_W 40 // Status Off Player:
#define RANK_STATUS_ON 41 // Player Is Online
#define RANK_STATUS_OFF 42 // Player Is Offline
#define CHANNEL_ONLINE_USERS 19 // ID Off Online Users: 00 Channel
#define CHANNEL_SAMP_ONLINE_USERS 20 // ID Off SA:MP Server's Online Users: 00 Channel
new TS_Onlines;
new TS_SampOnlines;
public OnFilterScriptInit()
{
TSC_Connect(TS_QUESER, TS_QPASS, TS_IP, TS_PORT);
TSC_ChangeNickname("SA:MP Control");
TS_Onlines = 0;
TS_SampOnlines = 0;
print("\n---------------------------------------");
print(" -NimA00GaMeR's TS Controller Loaded.- ");
print(" -Don't Remove Credits!- ");
print("---------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n---------------------------------------");
print(" -NimA00GaMeR's TS Controller Unloaded.- ");
print(" -Don't Remove Credits!- ");
print("---------------------------------------\n");
return 1;
}
forward TS_UpdateOnlineP();
forward TS_UpdateOnlineM();
public TS_UpdateOnlineP()
{
new channelname[512];
format(channelname, sizeof(channelname), "[cspacer]TS Online Users : [%d/1024]", TS_Onlines);
TSC_SetChannelName(CHANNEL_ONLINE_USERS, channelname);
return 1;
}
public TS_UpdateOnlineM()
{
new channelname[512];
format(channelname, sizeof(channelname), "[cspacer]TS Online Users : [%d/1024]", TS_Onlines);
TSC_SetChannelName(CHANNEL_ONLINE_USERS, channelname);
return 1;
}
//TSSSSS:DDDDDD
IsPlayerOnline(const nick[])
{
if(!nick[0]) return INVALID_PLAYER_ID; // empty nick
static name[MAX_PLAYER_NAME + 1];
for(new i, g = GetMaxPlayers(); i < g; i++)
if(IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof(name));
if(!strcmp(nick, name))
return i;
}
return INVALID_PLAYER_ID;
}
public TSC_OnError(TSC_ERROR_TYPE:error_type, error_id, const error_msg[])
{
printf("%s", error_msg);
return 1;
}
public TSC_OnClientConnect(clientid, nickname[])
{
TS_Onlines +=1;
TS_UpdateOnlineP();
TSC_RemoveClientFromServerGroup(clientid, RANK_STATUS_W);
// player is online
TSC_RemoveClientFromServerGroup(clientid, RANK_STATUS_ON);
// player is offline
TSC_RemoveClientFromServerGroup(clientid, RANK_STATUS_OFF);
new Online = IsPlayerOnline(nickname);
new Online2[128];
TSC_AddClientToServerGroup(clientid, RANK_STATUS_W);
if(Online != INVALID_PLAYER_ID) // or if you don't want ID use if(IsPlayerOnline(targetname) != INVALID_PLAYER_ID)
{
// player is online
Online2 = "[color=green]Online[/color]";
TSC_AddClientToServerGroup(clientid, RANK_STATUS_ON);
}
else
{
// player is offline
Online2 = "[color=red]Offline[/color]";
TSC_AddClientToServerGroup(clientid, RANK_STATUS_OFF);
}
new string[512];
format(string, sizeof(string), "Welcome [color=green]%s[/color]\n Your status in samp server : %s", nickname, Online2);
// print(string);
TSC_SendClientMessage(clientid, string);
// TSC_AddClientToServerGroup(clientid, TS_SERVER_GROUP_PLAYER);
return 1;
}
public TSC_OnClientDisconnect(clientid, reasonid, reasonmsg[])
{
TS_Onlines -=1;
TS_UpdateOnlineM();
return 1;
}
public OnPlayerConnect(playerid)
{
TS_SampOnlines ++;
UpdateSampOnlinesChannel();
new PlayerIP[24];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new ClientID = TSC_GetClientIdByIpAddress(PlayerIP);
new ClientDes[200];
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(ClientDes, sizeof(ClientDes), "Player's name in SA-MP: %s", PlayerName);
TSC_SetClientDescription(ClientID, ClientDes);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TS_SampOnlines --;
UpdateSampOnlinesChannel();
new PlayerIP[24];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new ClientID = TSC_GetClientIdByIpAddress(PlayerIP);
new ClientDes[200];
format(ClientDes, sizeof(ClientDes), "");
TSC_SetClientDescription(ClientID, ClientDes);
return 1;
}
forward UpdateSampOnlinesChannel();
public UpdateSampOnlinesChannel()
{
new channelname[512];
format(channelname, sizeof(channelname), "[cspacer]SA-MP Online Users : [%d/%d]", TS_SampOnlines, GetMaxPlayers());
TSC_SetChannelName(CHANNEL_SAMP_ONLINE_USERS, channelname);
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}