View difference between Paste ID: pa1nXz30 and HGxrD7JF
SHOW: | | - or go back to the newest paste.
1
// Filterscript de Eventos
2
// Criado Por Gabriel_Santos
3
// Creditos: Jonathan Feitosa
4
5
#include <a_samp>
6
#include <sscanf2>
7
#include <zcmd>
8
9
#define COR_VERMELHA 0xF66767AA
10
#define COR_BRANCO   0xFFFFFFAA
11
#define COR_AZUL     0x447FECAA
12
enum SystemEvento
13
{
14
	Float:Health,
15
	Float:Colete,
16
	Float:PosX,
17
	Float:PosY,
18
	Float:PosZ,
19
	grana,
20
	interior,
21
	ang,
22
	Skin,
23
};
24
new Eventos[MAX_PLAYERS][SystemEvento];
25
enum SistemaEventos
26
{
27
	bool:Eventoiniciado,
28
	bool:Eventotrancado,
29
	bool:Eventodestrancado,
30
	bool:Entrar,
31
	bool:Eventocontagem,
32
	interior,
33
};
34
new Gabriel[MAX_PLAYERS][SistemaEventos];
35
new Float:ex,Float:ey,Float:ez;
36
new Float:entroux,Float:entrouy,Float:entrouz;
37
new entraram;
38
new CountDown = -1;
39
new Veiculos[MAX_VEHICLES];
40
new VeiculosCriados = 0;
41
forward countdown();
42
43
44
public OnFilterScriptInit()
45
{
46
	print("\n--------------------------------------");
47
	print(" Filterscript Eventos v1.0 Ligado");
48
	print(" Feito Por Gabriel_Santos");
49
	print("--------------------------------------\n");
50
	return 1;
51
}
52
public OnPlayerRequestClass(playerid, classid)
53-
public OnFilterScriptExit()
53+
54
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
55
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
56
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
57
	return 1;
58-
public OnGameModeInit()
58+
59
60-
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
60+
61
{
62
	SendClientMessage(playerid, COR_AZUL,"Esse Servidor Conta com Um Sistema de Eventos Criado Por Gabriel_Santos.");
63
    Gabriel[playerid][Eventoiniciado] = false;
64-
public OnGameModeExit()
64+
65
    Gabriel[playerid][Eventotrancado] = false;
66
    Gabriel[playerid][Entrar] = false;
67
	return 1;
68
}
69
forward OnPlayerCommandReceived(playerid, cmdtext[]);
70
public OnPlayerCommandReceived(playerid, cmdtext[])
71
{
72
    return 1;
73
}
74
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
75
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
76
{
77
	return 1;
78
}
79
public OnPlayerDeath(playerid, killerid, reason)
80
{
81
    Gabriel[playerid][Entrar] = false;
82
    SetPlayerVirtualWorld(playerid, 0);
83
	return 1;
84
}
85
//INICIO COMANDOS DO SISTEMA
86
new streventu[128];
87-
public OnPlayerDisconnect(playerid, reason)
87+
88
new string[256];
89
90
CMD:ajudaevento(playerid, params[])
91
{
92-
public OnPlayerSpawn(playerid)
92+
93
	SendClientMessage(playerid, COR_AZUL, "[EVENTO SYSTEM]: /carroevento,/vidaevento,/armaevento,/coleteevento,/contagemevento,/congelarevento,/descongelarevento.");
94
	return 1;
95
}
96
CMD:criarevento(playerid, params[])
97
{
98
	new result[156];
99
    new string[256];
100
	if(sscanf(params, "s[124]", result)) return SendClientMessage(playerid, 0xFFFFFFAA, "Use: /criarevento [Tipo]");
101
    {
102
        GetPlayerName(playerid,admnick, 24);
103
		GetPlayerPos(playerid, ex, ey, ez);
104
        SalvarPlayer(playerid);
105
		Gabriel[playerid][interior] = GetPlayerInterior(playerid);
106
		for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
107
		{
108
			format(string,sizeof(string), "O Admin:[%s] ID:[%d] Criou um Evento de [%s] \n Para Participar Use: Sim Para Ficar onde Esta use: Não", admnick, playerid ,result);
109
			ShowPlayerDialog(possiveis, 2345, DIALOG_STYLE_MSGBOX, "Sistema de Eventos", string, "Sim", "Não");
110
			Gabriel[possiveis][Eventoiniciado] = true;
111
			Gabriel[possiveis][Eventotrancado] = false;
112
			Gabriel[possiveis][Eventodestrancado] = false;
113
			Gabriel[playerid][Entrar] = false;
114
		}
115
	}
116
	return 1;
117
}
118
CMD:finalizarevento(playerid, params[])
119
{
120
	GetPlayerName(playerid,admnick, 24);
121
	format(streventu, 128, "[SISTEMA DE EVENTO] O Administrador [%s] ID:[%d] Finalizou o Evento", admnick, playerid);
122
	SendClientMessageToAll(COR_AZUL, streventu);
123
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
124
	{
125
		GameTextForPlayer(possiveis,"~w~evento ~r~terminado", 2500, 1);
126
		Gabriel[possiveis][Eventotrancado] = false;
127
		Gabriel[possiveis][Eventoiniciado] = false;
128
		Gabriel[possiveis][Eventodestrancado] = false;
129
	}
130
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
131
	{
132
		Gabriel[possiveis][Entrar] = false;
133
		SetPlayerInterior(playerid, 0);
134
		SetPlayerPos(playerid, entroux, entrouy, entrouz);
135
		SetPlayerVirtualWorld(playerid, 0);
136
		SetPlayerInterior(playerid, Gabriel[playerid][interior]);
137
	}
138
	for(new carros = 0; carros < MAX_VEHICLES; carros++)
139
	{
140
		if(Veiculos[carros])
141
		{
142
			DestroyVehicle(Veiculos[carros]);
143
			Veiculos[carros] = 0;
144
			VeiculosCriados = 0;
145
		}
146
	}
147
	entraram = 0;
148
	return 1;
149
}
150
CMD:sairevento(playerid, params[])
151
{
152
	SetPlayerVirtualWorld(playerid, 0);
153
	Gabriel[playerid][Entrar] = false;
154
	entraram -- ;
155
	SetPlayerPos(playerid, entroux, entrouy, entrouz);
156
	return 1;
157
}
158
CMD:desarmarevento(playerid, params[])
159
{
160
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
161
	{
162
		ResetPlayerWeapons(possiveis);
163
		SetPlayerArmedWeapon(possiveis,0);
164
	}
165
	GetPlayerName(playerid,admnick, 24);
166
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador [%s] ID:[%d] desarmou todos jogadores do evento!", admnick, playerid);
167
	SendClientMessageToAll(COR_AZUL, streventu);
168
	return 1;
169
}
170
CMD:skinevento(playerid, params[])
171
{
172
	new skinide;
173
	if(sscanf(params, "d", skinide)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/skinevento [ID da Skin]");
174
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
175
	{
176
		SetPlayerSkin(possiveis, skinide);
177
	}
178
	return 1;
179
}
180
CMD:armaevento(playerid, params[])
181
{
182
	new gun;
183
	new ammo;
184
	if(sscanf(params, "dd", gun, ammo)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/armaevento [ID da Arma][Munição]");
185
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
186
	{
187
		GivePlayerWeapon(possiveis, gun, ammo);
188
	}
189
	GetPlayerName(playerid,admnick, 24);
190
	format(streventu, 128, "[SISTEMA DE EVENTO]O Administrador [%s] ID:[%d] deu arma [ID:%d] munição [%d] aos jogadores do evento!", admnick,playerid ,gun,ammo);
191
	SendClientMessageToAll(COR_AZUL, streventu);
192
	return 1;
193
}
194
CMD:contagemevento(playerid, params[])
195
{
196
	if(CountDown == -1)
197
	{
198
		CountDown = 6;
199
		SetTimer("countdown",1000,0);
200
		GetPlayerName(playerid,admnick, 24);
201
		format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] iniciou a contagem do evento!", admnick, playerid);
202
		SendClientMessageToAll(COR_AZUL, streventu);
203
	}
204
	return 1;
205
}
206
CMD:congelarevento(playerid, params[])
207
{
208
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
209
	{
210
		TogglePlayerControllable(possiveis, false);
211
	}
212
	GetPlayerName(playerid,admnick, 24);
213
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] congelou os jogadores do evento!", admnick, playerid);
214
	SendClientMessageToAll(COR_AZUL, streventu);
215
	return 1;
216
}
217
CMD:descongelarevento(playerid, params[])
218
{
219
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
220
	{
221
		TogglePlayerControllable(possiveis, true);
222
	}
223
	GetPlayerName(playerid,admnick, 24);
224
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%s] descongelou os jogadores do evento!", admnick, playerid);
225
	SendClientMessageToAll(COR_AZUL, streventu);
226
	return 1;
227
}
228
CMD:coleteevento(playerid, params[])
229
{
230
	new colete;
231
	if(sscanf(params, "d", colete)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/coleteevento[COLETE]");
232
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
233
	{
234
		SetPlayerArmour(possiveis, colete);
235
	}
236
	GetPlayerName(playerid,admnick, 24);
237
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] setou Colete [%d] para os jogadores do evento", admnick,playerid,colete);
238
	SendClientMessageToAll(COR_AZUL, streventu);
239
	return 1;
240
}
241
CMD:vidaevento(playerid, params[])
242
{
243
	new vida;
244
	if(sscanf(params, "d", vida)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/vidaevento [VIDA]");
245
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
246
	{
247
		SetPlayerHealth(possiveis,vida);
248
	}
249
	GetPlayerName(playerid,admnick, 24);
250
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] setou Vida [%d] para os jogadores do evento", admnick,playerid,vida);
251
	SendClientMessageToAll(COR_AZUL, streventu);
252
	return 1;
253
}
254
CMD:carroevento(playerid, params[])
255
{
256
	new carro;
257
	if(sscanf(params, "d", carro)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/carroevento [ID do Carro]");
258
	if(carro < 400 || carro > 611)
259
	{
260
		SendClientMessage(playerid, COR_VERMELHA, "  O ID do veiculo digitado está invalido! veiculos de 400 á 611");
261
		return 1;
262
	}
263
	for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[possiveis][Entrar] == true)
264
	{
265
		new Float:X = 0,Float:Y = 0,Float:Z = 0,Float:Angulo = 0;
266
		GetPlayerPos(possiveis, X,Y,Z);
267
		GetPlayerFacingAngle(playerid, Angulo);
268
		Veiculos[VeiculosCriados++] = CreateVehicle(carro, X, Y, Z, 0, random(126), random(126), 60000);
269
		LinkVehicleToInterior(Veiculos[VeiculosCriados-1], GetPlayerInterior(possiveis));
270
		SetVehicleVirtualWorld(Veiculos[VeiculosCriados-1], GetPlayerVirtualWorld(possiveis));
271
		PutPlayerInVehicle(possiveis, Veiculos[VeiculosCriados-1], 0);
272
	}
273
	GetPlayerName(playerid,admnick, 24);
274
	format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] deu carro ID:%d aos jogadores do evento!", admnick,carro);
275
	SendClientMessageToAll(COR_AZUL, streventu);
276
	return 1;
277
}
278
public countdown()
279
{
280
	if(CountDown==6) GameTextForAll("~p~Starting...",1000,6);
281
282
	CountDown--;
283
	if(CountDown==0)
284
	{
285
		GameTextForAll("~g~GO~ r~!",1000,6);
286
		CountDown = -1;
287
		for(new i = 0; i < MAX_PLAYERS; i++) {
288
			TogglePlayerControllable(i,true);
289
			PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
290
		}
291
		return 0;
292
	}
293
	else
294
	{
295
		new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
296
		for(new i = 0; i < MAX_PLAYERS; i++) {
297
			PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
298
			TogglePlayerControllable(i,false);
299
		}
300
	 	GameTextForAll(text,1000,6);
301
	}
302
303
	SetTimer("countdown",1000,0);
304
	return 0;
305
}
306
stock SalvarPlayer(playerid)
307
{
308
	new Float: health, Float: armour, Float: SX, Float: SY, Float: SZ;
309
	GetPlayerHealth(playerid, health);
310
	GetPlayerArmour(playerid, armour);
311
	GetPlayerPos(playerid, SX, SY, SZ);
312
	Eventos[playerid][grana] = GetPlayerMoney(playerid);
313
	Eventos[playerid][Skin] = GetPlayerSkin(playerid);
314
	if (armour > 0) Eventos[playerid][Colete] = armour;
315
	Eventos[playerid][PosX] = SX;
316
	Eventos[playerid][PosY] = SY;
317
	Eventos[playerid][PosZ] = SZ;
318
	Eventos[playerid][interior] = GetPlayerInterior(playerid);
319
}
320
stock UsarPlayer(playerid)
321
{
322
	SetPlayerSkin(playerid,Eventos[playerid][Skin]);
323
    GivePlayerMoney(playerid, Eventos[playerid][grana]);
324
    SetPlayerArmour(playerid, Eventos[playerid][Colete]);
325
    SetPlayerPos(playerid, Eventos[playerid][PosX],
326
	AirtonData[playerid][PosY], Eventos[playerid][PosZ]);
327
	SetPlayerFacingAngle(playerid, Eventos[playerid][grana]);
328
	SetPlayerInterior(playerid, Eventos[playerid][grana]);
329
	SetPlayerInterior(playerid, Eventos[playerid][interior]);
330
	return 1;
331
}
332
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
333
{
334
		if(dialogid == 2345)
335
		{
336
 			if(response == 1)
337
			{
338
				SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: voce foi para o evento");
339
				SalvarPlayer(playerid);
340
				Gabriel[playerid][Entrar] = true;
341
				entraram++;
342
				SetPlayerPos(playerid, ex, ey, ez);
343
				SetPlayerVirtualWorld(playerid, 5);
344
				SetPlayerInterior(playerid, Gabriel[playerid][interior]);
345
				return true;
346
    		}
347
    		if(response == 0)
348
   			{
349
  				SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: voce nao foi para o evento");
350
                return true;
351
	   		}
352
		}
353
		return 1;
354
}