View difference between Paste ID: NQT3UqFM and wPY2gQGa
SHOW: | | - or go back to the newest paste.
1
/*
2
3
              ____ _____  _         _                      _
4
             / ___|_   _|/ \       / \   _ __ ___ __ _  __| | ___
5
            | |  _  | | / _ \     / _ \ | '__/ __/ _` |/ _` |/ _ \
6
            | |_| | | |/ ___ \   / ___ \| | | (_| (_| | (_| |  __/
7
             \____| |_/_/   \_\ /_/   \_\_|  \___\__,_|\__,_|\___|
8
9
		  Criado por Bruno da Silva e Robson ([iPs]DraKiNs & [S]trong)
10
11
						www.ips-team.blogpsot.com
12
13
14
	Desenvolvimento Geral:
15
		Modo de jogo em geral criado e idealizado por Bruno e Robson.
16
17
	Agradecimentos a:
18
				Diogo Bras - Ajuda com base no teste do código
19
				
20
*/
21
22
//====================== [ Diretivas ] =========================================
23
24
#include a_samp
25
#include a_sii
26
27
#define SERVIDOR_MODE    "(Arcade) (Death Match)"
28
29
#undef  MAX_PLAYERS
30
#undef  MAX_PICKUPS
31
32
#define MAX_PLAYERS                                                             (32)
33
#define MAX_RANK                                                                (5)
34
#define MAX_PICKUPS                                                             (90)
35
36
#define ContaPlayer     "Contas/%s.ini"
37
38
#define DialogLogin     (006)
39
#define DialogRegistro  (007)
40
41
#define COLOR_LIGHTGREEN 0xB8FF00FF
42
#define COLOR_GREYGREEN  0xCCDD66FF
43
#define COLOR_DARKBLUE   0x9966FFFF
44
#define COLOR_PEPPER     0xDD3333FF
45
#define COLOR_YELLOW     0xFFEA00FF
46
#define COLOR_ORANGE     0xFAAB00FF
47
#define COLOR_WHITE      0xFFFFFFFF
48
#define COLOR_RED        0xFF0000FF
49
50
#define cmd(%1,%2,%3)                                                           @%1(%2,%3);  public @%1(%2,%3)
51
#define TRACAR_SERVIDOR                                                         0
52
53
//====================== [ Declarações ] =======================================
54
55
checarPause();
56
iniciarSistema();
57
tirarSpawnKill(i);
58
atualizarContagem();
59
MoveCamera(playerid,rand);
60
DestroyPickupEx(pickupid);
61
forward OnPlayerSyncronize(playerid);
62
63
enum pInfo
64
{
65
    bool:SpawnDance,
66
    Float:SpawnAngle,
67
    SpawnTimer
68
};
69
70
new
71
	selecaoFechada[MAX_PLAYERS char],
72
	SkinClass[MAX_PLAYERS char][pInfo]
73
;
74
75
new
76
	string_contar[50],
77
	totalContagem;
78
79
new
80
	Float:cordinatex,
81
	Float:cordinatey,
82
	Float:cordinatez,
83
	Float:cordinateangle;
84
85
new Float:pedirCameraSpawn[9][4] =
86
{
87
    {1296.4391,1583.2622,50.2969,317.8491},
88
    {1054.8481,1019.7778,57.3438,95.0108},
89
    {1452.0229,750.9430,32.6900,88.4309},
90
    {2213.8701,1679.2406,57.3038,91.4144 },
91
    {746.1910,740.3755,29.1076,24.4488},
92
    {199.7275,1393.2085,47.8297,179.5663},
93
    {596.4931,1502.9486,9.0578,29.4318},
94
    {-207.8227,1901.1121,128.4624,68.0533},
95
    {-2387.3440,2401.0579,20.7627,240.9129}
96
};
97
98
new
99
	Text:introTextDraw1,
100
	Text:introTextDraw2,
101
	Text:introTextDraw3,
102
	Text:introTextDraw4,
103
	Text:introTextDraw5;
104
105
new nicksProibido[][MAX_PLAYER_NAME] =
106
{
107
    "com1","com2","com3","com4","com5","com6","com7","com8","com9","lpt1","lpt2","lpt3","lpt4","lpt5","lpt6","lpt7","lpt8","lpt9",
108
    "Carl","Rocky","Sony","clock$","prn","nul","con",   "Azucar","CON","con","con1","aux","aux1","prn","PRN","AUX"
109
};
110
111
enum PlayerData
112
{
113
    sync,
114
    spree,
115
    kills,
116
    deaths,
117
    pontos,
118
    updatetime,
119
    bool:paused
120
}
121
122
123
new
124
	maximoAreas = 0,
125
	gangZoneAtual = 0,
126
	circuitoArquivo = 0,
127
	Text:tempoAtualRound,
128
	jogadoresConectados = 0,
129
	armaPickup[MAX_PICKUPS],
130
	jogadoresLoop[MAX_PLAYERS],
131
	Float:posicoesAreas[4000][4],
132
	armamentoPickup[MAX_PICKUPS],
133
	pickupFerramentas[MAX_PICKUPS],
134
	Text3D:atacarTexto[MAX_PLAYERS],
135
	Float:armazenarAreaAtual[400][4],
136
	bool:jogadorNoRanking[MAX_PLAYERS],
137
	PlayerInfo[MAX_PLAYERS][PlayerData],
138
	jogadorRanking[MAX_RANK] = {-1, ...},
139
	jogadorRankingID[MAX_PLAYERS] = {-1, ...};
140
141
//====================== [ Variaveis Públicas ] ================================
142
143
public OnGameModeExit()
144
{
145
    TextDrawHideForAll(introTextDraw1);
146
    TextDrawDestroy(introTextDraw1);
147
    TextDrawHideForAll(introTextDraw2);
148
    TextDrawDestroy(introTextDraw2);
149
    TextDrawHideForAll(introTextDraw3);
150
    TextDrawDestroy(introTextDraw3);
151
    TextDrawHideForAll(introTextDraw4);
152
    TextDrawDestroy(introTextDraw4);
153
    TextDrawHideForAll(introTextDraw5);
154
    TextDrawDestroy(introTextDraw5);
155
    return true;
156
}
157
158
159
main()
160
{
161
    new
162
        buuferArquivo[164],
163
        stringPosicao[3][46],
164
        divisoresAchados = 0;
165
166
    new File:lerArquivo = fopen("randomSpawn.txt", io_read);
167
    while(fread(lerArquivo, buuferArquivo)) {     //reads the file line-by-line
168
    
169
        divisoresAchados = 0;
170
171
        for(new i; buuferArquivo[i]; i++) {
172
            if(buuferArquivo[i] == ',') {
173
                divisoresAchados++;
174
            }
175
        }
176
177
        if(divisoresAchados != 2) {
178
            continue;
179
        }
180
181
        split(buuferArquivo, stringPosicao, ',');
182
183
        posicoesAreas[circuitoArquivo][0] = floatstr(stringPosicao[0]),
184
            posicoesAreas[circuitoArquivo][1] = floatstr(stringPosicao[1]),
185
            posicoesAreas[circuitoArquivo][2] = floatstr(stringPosicao[2]),
186
            ++circuitoArquivo;
187
188
    }
189
    fclose(lerArquivo);
190
191
    state estadoServidor:destrancar;
192
193
    tempoAtualRound = TextDrawCreate(015, 333,!"Tempo: %02d/600");
194
    TextDrawAlignment(tempoAtualRound,0);
195
    TextDrawBackgroundColor(tempoAtualRound,0x000000ff);
196
    TextDrawFont(tempoAtualRound,1);
197
    TextDrawLetterSize(tempoAtualRound,0.2999, 0.9);
198
    TextDrawBoxColor(tempoAtualRound,0x00000050);
199
    TextDrawColor(tempoAtualRound,0xffffffff);
200
    TextDrawSetOutline(tempoAtualRound,1);
201
    TextDrawSetProportional(tempoAtualRound,1);
202
    TextDrawSetShadow(tempoAtualRound,1);
203
204
    for(new skinAtual = 0; skinAtual != 300; skinAtual++) {
205
        if (IsValidSkin(skinAtual)) {
206
            AddPlayerClass(skinAtual, 2088.0701, 2074.0896, 10.8203, 273.3924, 3, 1, 0, 0, 0, 0);
207
        }
208
        continue;
209
    }
210
211
    introTextDraw1 = TextDrawCreate(240.000000, 83.000000, "GTA Arcade");
212
    TextDrawBackgroundColor(introTextDraw1, 255);
213
    TextDrawFont(introTextDraw1, 1);
214
    TextDrawLetterSize(introTextDraw1, 0.789999, 2.200000);
215
    TextDrawColor(introTextDraw1, -1);
216
    TextDrawSetOutline(introTextDraw1, 1);
217
    TextDrawSetProportional(introTextDraw1, 1);
218
219
    introTextDraw2 = TextDrawCreate(654.000000, 0.000000, ".");
220
    TextDrawBackgroundColor(introTextDraw2, 255);
221
    TextDrawFont(introTextDraw2, 1);
222
    TextDrawLetterSize(introTextDraw2, 0.500000, 4.999997);
223
    TextDrawColor(introTextDraw2, -1);
224
    TextDrawSetOutline(introTextDraw2, 0);
225
    TextDrawSetProportional(introTextDraw2, 1);
226
    TextDrawSetShadow(introTextDraw2, 1);
227
    TextDrawUseBox(introTextDraw2, 1);
228
    TextDrawBoxColor(introTextDraw2, 255);
229
    TextDrawTextSize(introTextDraw2, -18.000000, 5.000000);
230
231
    introTextDraw3 = TextDrawCreate(654.000000, 408.000000, "a ~n~a");
232
    TextDrawBackgroundColor(introTextDraw3, 255);
233
    TextDrawFont(introTextDraw3, 1);
234
    TextDrawLetterSize(introTextDraw3, 0.500000, 4.999997);
235
    TextDrawColor(introTextDraw3, -1);
236
    TextDrawSetOutline(introTextDraw3, 0);
237
    TextDrawSetProportional(introTextDraw3, 1);
238
    TextDrawSetShadow(introTextDraw3, 1);
239
    TextDrawUseBox(introTextDraw3, 1);
240
    TextDrawBoxColor(introTextDraw3, 255);
241
    TextDrawTextSize(introTextDraw3, -18.000000, 5.000000);
242
243
    introTextDraw4 = TextDrawCreate(206.000000, 429.000000, "www.ips-team.blogspot.com");
244
    TextDrawBackgroundColor(introTextDraw4, 255);
245
    TextDrawFont(introTextDraw4, 1);
246
    TextDrawLetterSize(introTextDraw4, 0.420000, 1.300000);
247
    TextDrawColor(introTextDraw4, -1);
248
    TextDrawSetOutline(introTextDraw4, 0);
249
    TextDrawSetProportional(introTextDraw4, 1);
250
    TextDrawSetShadow(introTextDraw4, 1);
251
252
    introTextDraw5 = TextDrawCreate(199.000000, 189.000000, " ");
253
    TextDrawBackgroundColor(introTextDraw5, 255);
254
    TextDrawFont(introTextDraw5, 1);
255
    TextDrawLetterSize(introTextDraw5, 0.500000, 2.000000);
256
    TextDrawColor(introTextDraw5, -1);
257
    TextDrawSetOutline(introTextDraw5, 0);
258
    TextDrawSetProportional(introTextDraw5, 1);
259
    TextDrawSetShadow(introTextDraw5, 1);
260
261
    UsePlayerPedAnims();
262
263
    SendRconCommand("mapname [iPs] TeaM");
264
    SendRconCommand("gamemodetext [iPs]Arcade GameMode");
265
    SendRconCommand("weburl www.ips-team.blogspot.com");
266
    SendRconCommand("hostname Servidor Arcade » [iPs]TeaM - Entre Já!");
267
268
    iniciarSistema();
269
    atualizarContagem();
270
    SetTimer("checarPause", 1000, true);
271
272
    new compilar[][] = {"\x?","\x?"};
273
#pragma unused compilar
274
    return true;
275
}
276
277
278
public OnPlayerConnect(playerid) <estadoServidor:destrancar>
279
{
280
    for(new i; i != _:PlayerData; i++) {
281
        PlayerInfo[playerid][PlayerData:i]  = 0;
282
    }
283
284
    for(new i; i != sizeof(nicksProibido); i++) {
285
        if(!strcmp(nicksProibido[i],GetPlayerNick(playerid),true)) {
286
            SendClientMessage(playerid,0xCC0000FF,"-OperServ- Seu nickname é inválido, você foi banido");
287
            Ban(playerid);
288
        }
289
        continue;
290
    }
291
292
    selecaoFechada{playerid} =0;
293
294
    ApplyAnimation(playerid,"BOMBER","null",0.0,0,0,0,0,0);
295
    ApplyAnimation(playerid,"SHOP","null",0.0,0,0,0,0,0);
296
    ApplyAnimation(playerid,"RAPPING","null",0.0,0,0,0,0,0);
297
    ApplyAnimation(playerid,"BEACH","null",0.0,0,0,0,0,0);
298
    ApplyAnimation(playerid,"SMOKING","null",0.0,0,0,0,0,0);
299
300
    ApplyAnimation(playerid,"FOOD","null",0.0,0,0,0,0,0);
301
    ApplyAnimation(playerid,"ON_LOOKERS","null",0.0,0,0,0,0,0);
302
    ApplyAnimation(playerid,"DEALER","null",0.0,0,0,0,0,0);
303
    ApplyAnimation(playerid,"CARRY","null",0.0,0,0,0,0,0);
304
    ApplyAnimation(playerid,"COP_AMBIENT","null",0.0,0,0,0,0,0);
305
306
    ApplyAnimation(playerid,"PARK","null",0.0,0,0,0,0,0);
307
    ApplyAnimation(playerid,"INT_HOUSE","null",0.0,0,0,0,0,0);
308
    ApplyAnimation(playerid,"FOOD","null",0.0,0,0,0,0,0);
309
310
    ApplyAnimation(playerid,"PED","null",0.0,0,0,0,0,0);
311
312
    SkinClass[playerid][SpawnDance] = true;
313
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
314
315
    SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # );
316
    SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # );
317
    SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # );
318
319
    return jogadoresLoop[jogadoresConectados++] = playerid, SetTimerEx("mostrarDialog", 800, false, "d", playerid);
320
}
321
322
323
mostrarDialog(playerid);
324
public mostrarDialog(playerid)
325
{
326
    static pName[128];
327
    SendDeathMessage(255,playerid,200);
328
329
    format(pName, 54, ContaPlayer, GetPlayerNick(playerid));
330
331
    if(!fexist(pName)) {
332
        format(pName, sizeof(pName), "{CCCCCC}Bem vindo ao Arcade [iPs]TeaM (DM) 1.0\nA conta {999933}%s{CCCCCC} não está registrada\nPor favor insira uma senha para registrá-la:", GetPlayerNick(playerid));
333
        ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "Cadastrar", pName, "Continuar", "Cancelar");
334
    }
335
    else {
336
        format(pName, sizeof(pName), "{CCCCCC}Bem vindo ao Arcade [iPs]TeaM (DM) 1.0\nA conta {999933}%s{CCCCCC} está registrada\nPor favor insira a sua senha para autenticar:", GetPlayerNick(playerid));
337
        ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "Autenticar Conta de Usuário", pName, "Autenticar", "Cancelar");
338
    }
339
    return true;
340
}
341
342
343
public OnPlayerDisconnect(playerid, reason)
344
{
345
    if (!IsPlayerNPC(playerid)) {
346
        for (new i; i < jogadoresConectados; i++) if (jogadoresLoop[i] == playerid) {
347
            jogadoresConectados--;
348
349
            jogadoresLoop[i] = jogadoresLoop[jogadoresConectados];
350
351
            break;
352
        }
353
    }
354
355
    SendDeathMessage(255,playerid,201);
356
357
    static pName[128];
358
    format(pName, 54, ContaPlayer, GetPlayerNick(playerid));
359
360
    if(!fexist(pName)) return false;
361
362
    INI_Open(pName);
363
    INI_WriteInt("Kills",   PlayerInfo[playerid][kills]);
364
365
    INI_WriteInt("Deaths",  PlayerInfo[playerid][deaths]);
366
367
    INI_WriteInt("Score",   PlayerInfo[playerid][pontos]);
368
    INI_Save();
369
370
    return INI_Close(), true;
371
}
372
373
374
//==============================================================================
375
376
public OnPlayerSpawn(playerid)
377
{
378
    if(!PlayerInfo[playerid][sync]) {
379
        TextDrawShowForPlayer(playerid, tempoAtualRound);
380
381
        SetPlayerHealth(playerid, Float:0x7F800000);
382
383
        SendClientMessage(playerid,COLOR_YELLOW, "-InfoServ- Aproveite, você tem 5 segundos de Anti Spawn Kill.");
384
385
        new randomPos = random(maximoAreas);
386
        SetPlayerPos(playerid, armazenarAreaAtual[randomPos][0], armazenarAreaAtual[randomPos][1], armazenarAreaAtual[randomPos][2] + 1.5);
387
388
        SetTimerEx("tirarSpawnKill", 5000, false, "i", playerid);
389
    }
390
    else PlayerInfo[playerid][sync] = false;
391
392
    TextDrawHideForPlayer(playerid, introTextDraw1);
393
    TextDrawHideForPlayer(playerid, introTextDraw2);
394
    TextDrawHideForPlayer(playerid, introTextDraw3);
395
    TextDrawHideForPlayer(playerid, introTextDraw4);
396
    TextDrawHideForPlayer(playerid, introTextDraw5);
397
398
    TextDrawHideForPlayer(playerid, tempoAtualRound);
399
    TextDrawShowForPlayer(playerid, tempoAtualRound);
400
401
    selecaoFechada{playerid}
402
    =0;
403
    SkinClass[playerid][SpawnAngle] = 0.0;
404
    SkinClass[playerid][SpawnDance] = true;
405
    KillTimer( SkinClass[playerid][SpawnTimer] );
406
407
    SetCameraBehindPlayer(playerid);
408
    return PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
409
}
410
411
412
public OnPlayerRequestClass(playerid, classid)
413
{
414
    PlayerPlaySound(playerid,1076,0.0,0.0,0.0);
415
    SetPlayerTime(playerid,23,0);
416
    SetPlayerWeather(playerid,15);
417
418
    SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # );
419
    SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # ); SendClientMessage(playerid, -1, # );
420
    SendClientMessage(playerid,COLOR_DARKBLUE,"Seja bem vindo ao servidor [iPs]TeaM " SERVIDOR_MODE);
421
422
    SendClientMessage(playerid,COLOR_ORANGE,"Leia nossas regras com cuidado, você às encontra no /regras.");
423
    SendClientMessage(playerid,COLOR_YELLOW,"Digite /admins para ver a lista de administradores online.");
424
    SendClientMessage(playerid,COLOR_LIGHTGREEN,"Use /report para reportar jogadores que quebrem as regras.");
425
    SendClientMessage(playerid,COLOR_GREYGREEN,"Visite também o nosso blog www.ips-team.blogspot.com");
426
427
    TextDrawShowForPlayer(playerid, introTextDraw1);
428
    TextDrawShowForPlayer(playerid, introTextDraw2);
429
    TextDrawShowForPlayer(playerid, introTextDraw3);
430
431
    TextDrawShowForPlayer(playerid, introTextDraw4);
432
    TextDrawShowForPlayer(playerid, introTextDraw5);
433
434
    if(selecaoFechada{playerid} == 0) {
435
        new rand = random(sizeof(pedirCameraSpawn));
436
437
        cordinatex = pedirCameraSpawn[rand][0];
438
        cordinatey = pedirCameraSpawn[rand][1];
439
        cordinatez = pedirCameraSpawn[rand][2];
440
441
        cordinateangle = pedirCameraSpawn[rand][3];
442
443
        SetPlayerPos(playerid,cordinatex,cordinatey,cordinatez);
444
        SetPlayerFacingAngle(playerid, cordinateangle);
445
446
        SetPlayerCameraPos(playerid,cordinatex+(3.8*floatsin(-cordinateangle,degrees)),cordinatey+(3.8*floatcos(-cordinateangle,degrees)),cordinatez);
447
        SetPlayerCameraLookAt(playerid, cordinatex,cordinatey,cordinatez);
448
449
        ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
450
        PlayerPlaySound(playerid, 1097,-119.9460,23.1096,12.2238);
451
452
        if (SkinClass[playerid][SpawnDance]) SkinClass[playerid][SpawnTimer] = SetTimerEx("MoveCamera", 50, true, "i", playerid);
453
        SkinClass[playerid][SpawnDance] = false;
454
    }
455
    return true;
456
}
457
458
459
public OnPlayerDeath(playerid, killerid, reason)
460
{
461
    static string[128];
462
    GetPlayerName(killerid, string, MAX_PLAYER_NAME);
463
464
    if(IsPlayerConnected(killerid)) {
465
        SendDeathMessage(killerid, playerid, reason);
466
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
467
468
        PlayerInfo[killerid][pontos]++;
469
470
        PlayerInfo[killerid][kills]++;
471
        PlayerInfo[playerid][deaths]++;
472
473
        PlayerInfo[killerid][spree]++,
474
            PlayerInfo[playerid][spree] = 0;
475
476
        format(string, 54, ContaPlayer, string);
477
478
        if(!fexist(string)) return false;
479
480
        INI_Open(string);
481
        INI_WriteInt("Kills",   PlayerInfo[killerid][kills]);
482
        INI_WriteInt("Deaths",  PlayerInfo[killerid][deaths]);
483
        INI_WriteInt("Score",   PlayerInfo[killerid][pontos]);
484
485
        GetPlayerName(killerid, string, MAX_PLAYER_NAME);
486
487
        if(PlayerInfo[killerid][spree] > INI_ReadInt("Spree")) {
488
            INI_WriteInt("Spree",PlayerInfo[killerid][spree]);
489
            SendClientMessage(killerid, 0x00FFFFFF, "-DeathServ- Você acaba de conseguir bater seu recorde de kills seguidos ");
490
        }
491
492
        switch (PlayerInfo[killerid][spree]) {
493
            case 3:
494
            {
495
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 3 seguidos (Owned)", string, killerid);
496
                SendClientMessageToAll(0x00FFFFFF, string);
497
498
                GameTextForPlayer(killerid, "~r~Owned" ,5000,6);
499
500
            }
501
            case 6:
502
            {
503
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 6 seguidos (Pwned)", string, killerid);
504
                SendClientMessageToAll(0x00FFFFFF, string);
505
506
                GameTextForPlayer(killerid, "~r~Pwned" ,5000,6);
507
            }
508
            case 9:
509
            {
510
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 9 seguidos (Mito)", string, killerid);
511
                SendClientMessageToAll(0x00FFFFFF, string);
512
                GameTextForPlayer(killerid, "~r~Mito" ,5000,6);
513
            }
514
            case 12:
515
            {
516
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 12 seguidos (Serial Killer)", string, killerid);
517
                SendClientMessageToAll(0x00FFFFFF, string);
518
519
                GameTextForPlayer(killerid, "~r~Serial Killer" ,5000,6);
520
            }
521
            case 17:
522
            {
523
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 17 seguidos (God Like)", string, killerid);
524
                SendClientMessageToAll(0x00FFFFFF, string);
525
526
                GameTextForPlayer(killerid, "~r~God Like" ,5000,6);
527
            }
528
            case 25:
529
            {
530
                format(string, 128, "-DeathServ- %s [%d] acaba de matar 25 seguidos (Chuck Norris)", string, killerid);
531
                SendClientMessageToAll(0x00FFFFFF, string);
532
533
                GameTextForPlayer(killerid, "~r~Chuck Norris" ,5000,6);
534
            }
535
        }
536
    }
537
538
    INI_Save();
539
    INI_Close();
540
541
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
542
543
    new
544
        informacaoArma[4],
545
        Float:coordenadaPickup[5];
546
547
    GetPlayerPos(playerid,coordenadaPickup[0],coordenadaPickup[1],coordenadaPickup[2]);
548
    GetPlayerFacingAngle(playerid,coordenadaPickup[3]);
549
550
    for(new x = 0; x < 13; x++) {
551
        GetPlayerWeaponData(playerid,x,informacaoArma[0],informacaoArma[1]);
552
        if(informacaoArma[0] != 0 && informacaoArma[1] > 0) {
553
            switch(informacaoArma[0]) {
554
                case 1: informacaoArma[2] = 331;
555
                case 2..8: informacaoArma[2] = informacaoArma[0]+331;
556
                case 9: informacaoArma[2] = 341;
557
558
                case 10..15: informacaoArma[2] = informacaoArma[0]+311;
559
                case 16..18: informacaoArma[2] = informacaoArma[0]+326;
560
561
                case 22..29: informacaoArma[2] = informacaoArma[0]+324;
562
                case 30,31: informacaoArma[2] = informacaoArma[0]+325;
563
                case 32: informacaoArma[2] = 372;
564
565
                case 33..45: informacaoArma[2] = informacaoArma[0]+324;
566
                case 46: informacaoArma[2] = 371;
567
            }
568
            informacaoArma[3] = CreatePickup(informacaoArma[2],3,coordenadaPickup[0]+ ( random( 10 ) * floatsin(-coordenadaPickup[4], degrees ) ),coordenadaPickup[1]+ ( random( 10 ) * floatcos( -coordenadaPickup[4], degrees ) ),coordenadaPickup[2],-1);
569
            armaPickup[informacaoArma[3]] = informacaoArma[0];
570
571
            pickupFerramentas[informacaoArma[3]] = informacaoArma[1];
572
573
            armamentoPickup[informacaoArma[3]] = SetTimerEx("DestroyPickupEx",15000,false,"i",informacaoArma[3]);
574
            coordenadaPickup[4] = random(360);
575
        }
576
    }
577
578
    format(string, 54, ContaPlayer, GetPlayerNick(playerid));
579
580
    if(!fexist(string)) return false;
581
582
    INI_Open(string);
583
    INI_WriteInt("Kills",   PlayerInfo[playerid][kills]);
584
    INI_WriteInt("Deaths",  PlayerInfo[playerid][deaths]);
585
    INI_WriteInt("Score",   PlayerInfo[playerid][pontos]);
586
    INI_Save();
587
588
    INI_Close();
589
590
    informacaoArma[3] = CreatePickup(1240,1,coordenadaPickup[0],coordenadaPickup[1],coordenadaPickup[2],-1);
591
    armamentoPickup[informacaoArma[3]] = SetTimerEx("DestroyPickupEx",15000,false,"i",informacaoArma[3]);
592
    return true;
593
}
594
595
596
public OnPlayerPickUpPickup(playerid,pickupid)
597
{
598
    if(!armaPickup[pickupid]) {
599
        static
600
            Float:Health;
601
602
        GetPlayerHealth(playerid,Health);
603
        Health = Health > 69 ? SetPlayerHealth(playerid,100) : SetPlayerHealth(playerid,Health+30);
604
        DestroyPickup(pickupid);
605
    }
606
    else {
607
        SetPlayerAmmo(playerid,armaPickup[pickupid],0);
608
        GivePlayerWeapon(playerid,armaPickup[pickupid],pickupFerramentas[pickupid]);
609
610
        KillTimer(armamentoPickup[pickupid]);
611
612
        armaPickup[pickupid] = 0;
613
614
        pickupFerramentas[pickupid] = 0;
615
        DestroyPickup(pickupid);
616
    }
617
    return true;
618
}
619
620
621
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
622
{
623
    if(dialogid == DialogRegistro) {
624
        if(response) {
625
            static pName[128];
626
            if(!inputtext[3]) {
627
                format(pName, sizeof(pName), "{CCCCCC}\nA conta {999933}%s{CCCCCC} não está registrada\nPor favor insira uma senha para registrá-la:", GetPlayerNick(playerid));
628
                return ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "Cadastrar", pName, "Continuar", "Cancelar");
629
            }
630
631
            format(pName, 54, ContaPlayer, GetPlayerNick(playerid));
632
633
            CriarArquivo(pName);
634
            INI_Open(pName);
635
636
            INI_WriteString("Senha",        inputtext);
637
            INI_WriteInt("Kills",        false);
638
            INI_WriteInt("Deaths",   false);
639
640
            INI_WriteInt("Admin",    false);
641
            INI_WriteInt("Score",        false);
642
643
            INI_Save();
644
            return INI_Close();
645
646
        }
647
        SendClientMessage(playerid,COLOR_PEPPER,"-WarnServ- A senha digita é inválida, você foi desconectado.");
648
649
        return Kick(playerid), true;
650
    }
651
    if(dialogid == DialogLogin) {
652
        if(response) {
653
            static pName[128];
654
            format(pName, 54, ContaPlayer, GetPlayerNick(playerid));
655
            if(strlen(inputtext) <3) {
656
                SendClientMessage(playerid,COLOR_PEPPER,"-WarnServ- A senha digita é inválida, favor digite-a corretamente.");
657
                format(pName, sizeof(pName), "{CCCCCC}\nA conta {999933}%s{CCCCCC} está registrada\nPor favor insira uma senha para autenticar a mesma:", GetPlayerNick(playerid));
658
659
                return ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "Autenticar conta de usuário", pName, "Continuar", "Cancelar");
660
            }
661
662
            INI_Open(pName);
663
            new password[128];
664
            if(INI_ReadString(password, "Senha", MAX_PLAYER_NAME) && !strcmp(password, inputtext, true)) {
665
                PlayerInfo[playerid][pontos] = INI_ReadInt("Score");
666
667
                PlayerInfo[playerid][deaths] = INI_ReadInt("Deaths");
668
669
                PlayerInfo[playerid][kills] = INI_ReadInt("Kills");
670
671
                SendClientMessage(playerid,COLOR_LIGHTGREEN,"-InfoServ- Você foi logado com sucesso!");
672
673
            }
674
            else {
675
                SendClientMessage(playerid,COLOR_PEPPER,"-WarnServ- A senha digita é inválida, favor digite-a corretamente.");
676
                format(pName, sizeof(pName), "{CCCCCC}\nA conta {999933}%s{CCCCCC} está registrada\nPor favor insira uma senha para autenticar a mesma:", GetPlayerNick(playerid));
677
                ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "Autenticar conta de usuário", pName, "Continuar", "Cancelar");
678
            }
679
            INI_Close();
680
        }
681
        else {
682
            SendClientMessage(playerid,COLOR_PEPPER,"-WarnServ- Obrigatório digitar a senha, você foi desconectado.");
683
            PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
684
685
            return Kick(playerid), true;
686
        }
687
    }
688
    return false;
689
}
690
691
692
public OnPlayerUpdate(playerid) <estadoServidor:destrancar>
693
{
694
    PlayerInfo[playerid][updatetime] = gettime();
695
696
    static Float:Health;
697
    ResetPlayerMoney(playerid); GetPlayerHealth(playerid,Health);
698
699
    return GivePlayerMoney(playerid, -floatround(Health)), true;
700
701
}
702
703
704
//========================= [ Comandos ] =======================================
705
706
new
707
paramNumero,
708
paramExecute,
709
paramTexto[128]
710
;
711
712
#define isnull(%1,%2) ((!(%1[%2])) || (((%1[%2]) == '\1') && (!(%1[%2+1]))))
713
714
public OnPlayerCommandText(playerid, cmdtext[]) <estadoServidor:destrancar>
715
{
716
    state (!strcmp(cmdtext, "/estado-servidor", true) && IsPlayerAdmin(playerid)) estadoServidor:trancar;
717
718
    if(!strcmp("/morrer", cmdtext, true)) {
719
        SendClientMessage(playerid,0xFF8000FF, "-InfoServ- Você acaba de se suicidar.");
720
        return SetPlayerHealth(playerid, 0.0), true;
721
722
    }
723
724
    if(!strcmp("/offline", cmdtext, true)) {
725
        if(!PlayerInfo[playerid][paused]) {
726
            TogglePlayerControllable(playerid, false);
727
728
            atacarTexto[playerid] = Create3DTextLabel("Jogador Offline", 0xFFFF00AA, 30.0,40.0,50.0,40.0,0);
729
            Attach3DTextLabelToPlayer(atacarTexto[playerid], playerid, 0.0, 0.0, 0.7);
730
731
            static string[128];
732
733
            format(string, 128, "-InfoServ- O Jogador %s (%d) está ausente (/online)", GetPlayerNick(playerid), playerid);
734
            SendClientMessageToAll(0xFF8000FF, string);
735
736
            PlayerInfo[playerid][paused] = true;
737
738
        }
739
        return true;
740
741
    }
742
743
    if(!strcmp("/online", cmdtext, true)) {
744
        if(PlayerInfo[playerid][paused]) {
745
            TogglePlayerControllable(playerid, true);
746
747
            static string[128];
748
749
            format(string, 128, "-InfoServ- O Jogador %s (%d) está online (/offline)", GetPlayerNick(playerid), playerid);
750
            SendClientMessageToAll(0xFF8000FF, string);
751
752
            Delete3DTextLabel(atacarTexto[playerid]);
753
            PlayerInfo[playerid][paused] = false;
754
755
        }
756
        return true;
757
758
    }
759
760
    if(!strcmp("/spawn", cmdtext, true)) {
761
        if(!IsPlayerAdmin(playerid))                            return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Você não é um administrador.");
762
763
        static
764
            Float:xPos,
765
            Float:yPos,
766
            Float:zPos,
767
            string[128] ;
768
769
        GetPlayerPos(playerid, xPos, yPos, zPos);
770
771
        new File:arquivo = fopen("randomSpawn.txt", io_append);
772
        format(string, 128, "\r\n%f, %f, %f", xPos, yPos, zPos);
773
774
        fwrite(arquivo, string);
775
        fclose(arquivo);
776
777
        format(string, 128, "-InfoServer- Você salvou uma posição no nome de %s ", GetPlayerNick(playerid));
778
        SendClientMessage(playerid,0xFF8000FF,string);
779
780
        return true;
781
782
    }
783
784
    if(!strcmp("/sync", cmdtext, true)) {
785
        OnPlayerSyncronize(playerid);
786
        SendClientMessage(playerid,0xFF8000FF, "-InfoServ- Sincronizado com sucesso");
787
        return true;
788
789
    }
790
791
    if(!strcmp("/admins", cmdtext, true)) {
792
        static string[128];
793
        SendClientMessage(playerid, 0xFFFFFFFF, "Procurando Administradores Online . . .");
794
        for(new j = 1, i = jogadoresLoop[0]; j  != jogadoresConectados+1; i = jogadoresLoop[j], j++) {
795
            if(IsPlayerAdmin(playerid)) {
796
                GetPlayerName(i, string, MAX_PLAYER_NAME);
797
                format(string, 128, "[%i] Administrador %s", i,string);
798
                SendClientMessage(playerid, 0xFFFFFFFF, string);
799
            }
800
        }
801
        return true;
802
    }
803
804
    if(!strcmp("/admcmds", cmdtext, true)) {
805
        if(!IsPlayerAdmin(playerid))                            return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Você não é um administrador.");
806
        return  SendClientMessage(playerid, 0xFFFFFFFF, " /score \n /matar \n /vida \n /colete \n /kick \n /banir \n /mudarround \n /spawn \n");
807
808
    }
809
810
    if(!strcmp("/mudarround", cmdtext, true)) {
811
        if(!IsPlayerAdmin(playerid))                            return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Você não é um administrador.");
812
        return  totalContagem = 600, SendClientMessageToAll(0xFFFFFFFF, " - InfoServ - Um administrador alterou o round");
813
814
    }
815
816
    if(!strcmp("/cmds", cmdtext, true)) {
817
        return  SendClientMessage(playerid, COLOR_YELLOW, " /morrer \n /status \n /admins \n /sync \n /cmds\n");
818
819
    }
820
821
    new cmdname[32], cmdindex;
822
    while(cmdtext[cmdindex++] > ' ') {
823
        cmdname[cmdindex- 1] = tolower(cmdtext[cmdindex]);
824
    }
825
826
    format(cmdname, sizeof(cmdname), "@%s", cmdname);
827
828
    if(funcidx(cmdname) != -1) {
829
        return cmdtext[cmdindex] ? CallLocalFunction(cmdname, "ds", playerid, cmdtext[cmdindex + 1]) : CallLocalFunction(cmdname, "ds", playerid, "\1") ;
830
    }
831
832
    return SendClientMessage(playerid,0xCC0000FF, "-WarnServ- O comando digitado é inválido. Tente /comandos.");
833
834
}
835
836
837
cmd(score, playerid, params[])
838
{
839
    if(!IsPlayerAdmin(playerid))                            return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Você não é um administrador.");
840
    if(!sscanf(params, "ui", paramNumero, paramExecute))    return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /score <id> <score>");
841
    if(!IsPlayerConnected(paramNumero))                     return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
842
843
    SendClientMessage(paramNumero, 0xFF8000FF, "-InfoServ- O seu score foi alterado por um administrador.");
844
    return SetPlayerScore(paramNumero, paramExecute), SendClientMessage(playerid, 0xFF8000FF, "-InfoServ- O score do jogador foi alterado com sucesso.");
845
}
846
847
848
cmd(matar, playerid, params[])
849
{
850
    if(!IsPlayerAdmin(playerid))                return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Para executar este comando precisa ser administrador");
851
    if(!sscanf(params, "u", paramNumero))       return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /matar <id>");
852
    if(!IsPlayerConnected(paramNumero))         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
853
854
    SendClientMessage(paramNumero, 0xFF8000FF, "-InfoServ- Morto por um administrador");
855
856
    return SetPlayerHealth(paramNumero, 0.0);
857
}
858
859
860
cmd(status, playerid, params[])
861
{
862
    if(!sscanf(params, "u", paramNumero))      return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /status <id>");
863
    if(!IsPlayerConnected(paramNumero))         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
864
865
    static string[128];
866
    format(string, 128, "Vida: %d -  Total: %d - Score Round: %d - Matou %d - Morreu %d - Spree %d", ~GetPlayerMoney(paramNumero), PlayerInfo[paramNumero][pontos], GetPlayerScore(paramNumero), PlayerInfo[paramNumero][kills], PlayerInfo[paramNumero][deaths], PlayerInfo[paramNumero][spree]);
867
868
    return SendClientMessage(playerid,0xFF8000FF, string);
869
}
870
871
872
cmd(pm, playerid, params[])
873
{
874
    paramTexto[0] = EOS;
875
    if(!sscanf(params, "us", paramNumero,paramTexto))       return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /pm <id> <msg>");
876
    if(!IsPlayerConnected(paramNumero) || IsPlayerNPC(paramNumero) || paramNumero == playerid)         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
877
878
    PlayerPlaySound(paramNumero, 1057, 0.0, 0.0, 0.0);
879
    GameTextForPlayer(playerid, "MENSAGEM PRIVADA ~b~ENVIADA", 2500, 3);
880
881
    format(paramTexto, 128, "-PrivateServ- %s diz para %s: %s", GetPlayerNick(playerid),GetPlayerNick(paramNumero), paramTexto);
882
    SendClientMessage(paramNumero, 0xCC0000FF, paramTexto);
883
    SendClientMessage(playerid, 0xCC0000FF, paramTexto);
884
885
    PlayerPlaySound(paramNumero, 1057, 0.0, 0.0, 0.0);
886
    GameTextForPlayer(paramNumero, "MENSAGEM PRIVADA ~b~RECEBIDA", 2500, 3);
887
    return true;
888
}
889
890
891
cmd(vida, playerid, params[])
892
{
893
    if(!IsPlayerAdmin(playerid))                                return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Para executar este comando precisa ser administrador");
894
    if(!sscanf(params, "ud", paramNumero, paramExecute))       return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /vida <id> <quantia>");
895
    if(!IsPlayerConnected(paramNumero))                         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
896
897
    SendClientMessage(paramNumero, 0xFF8000FF, "-InfoServ- Sua vida foi mudada por um administrador");
898
899
    return SetPlayerHealth(paramNumero, paramExecute);
900
}
901
902
903
cmd(colete, playerid, params[])
904
{
905
    if(!IsPlayerAdmin(playerid))                                return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Para executar este comando precisa ser administrador");
906
    if(!sscanf(params, "ud", paramNumero, paramExecute))       return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /colete <id> <quantia>");
907
    if(!IsPlayerConnected(paramNumero))                         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
908
909
    SendClientMessage(paramNumero, 0xFF8000FF, "-InfoServ- Seu colete foi mudado por um administrador");
910
911
    return SetPlayerArmour(paramNumero, paramExecute);
912
}
913
914
915
cmd(banir, playerid, params[])
916
{
917
    paramTexto[0] = EOS;
918
    if(!IsPlayerAdmin(playerid))                                return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Para executar este comando precisa ser administrador");
919
    if(!sscanf(params, "us", paramNumero, paramTexto))          return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /banir <id> <motivo>");
920
    if(!IsPlayerConnected(paramNumero))                         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
921
922
    format(paramTexto, 128, "-OperServ- %s foi banido por um administrador | Motivo de %s", GetPlayerNick(paramNumero), paramTexto);
923
    SendClientMessageToAll(0xCC0000FF, paramTexto);
924
925
    return BanEx(paramNumero,paramTexto);
926
}
927
928
929
cmd(kick, playerid, params[])
930
{
931
    paramTexto[0] = EOS;
932
    if(!IsPlayerAdmin(playerid))                                return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Para executar este comando precisa ser administrador");
933
    if(!sscanf(params, "us", paramNumero, paramTexto))          return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Digite /kick <id> <motivo>");
934
    if(!IsPlayerConnected(paramNumero))                         return SendClientMessage(playerid, 0xCC0000FF, "-WarnServ- Jogador encontra-se offline");
935
936
    format(paramTexto, 128, "-OperServ- %s foi kickado por um administrador | Motivo de %s", GetPlayerNick(paramNumero), paramTexto);
937
    SendClientMessageToAll(0xCC0000FF, paramTexto);
938
939
    return Kick(paramNumero);
940
}
941
942
943
//==============================================================================
944
945
IsValidSkin(skinid)
946
{
947
    new
948
        skinInvalida[22] = {3, 4, 5, 6, 8, 42, 65, 74,86,119, 149, 208, 273, 289};
949
950
    if (skinid < 0 || skinid > 299) {
951
        return false;
952
    }
953
954
    for (new i = 0; i != 22; ++i) {
955
        if (skinid == skinInvalida[i]) {
956
            return false;
957
        }
958
        continue;
959
    }
960
    return true;
961
}
962
963
964
public tirarSpawnKill(i)
965
{
966
    GivePlayerWeapon(i, 4, 800);
967
    GivePlayerWeapon(i, 16, 1);
968
    GivePlayerWeapon(i, 25, 800);
969
970
    GivePlayerWeapon(i, 34, 800);
971
    GivePlayerWeapon(i, 24, 800);
972
973
    SetPlayerHealth(i, 100.0);
974
975
    SendClientMessage(i,0xFF8000FF, "-InfoServ- O AntiSpawnKill terminou!");
976
    return true;
977
}
978
979
980
public MoveCamera(playerid,rand)
981
{
982
    SetPlayerCameraPos(playerid, cordinatex - 2 * floatsin(-SkinClass[playerid][SpawnAngle], degrees), cordinatey - 10 * floatcos(-SkinClass[playerid][SpawnAngle], degrees), cordinatez + 3);
983
    SetPlayerCameraLookAt(playerid, cordinatex, cordinatey, cordinatez + 0.5);
984
985
    SkinClass[playerid][SpawnAngle] += 0.5;
986
987
    if (SkinClass[playerid][SpawnAngle] >=360.0) {
988
        SkinClass[playerid][SpawnAngle] = 0.0;
989
    }
990
991
    return true;
992
}
993
994
995
public OnPlayerSyncronize(playerid)
996
{
997
    PlayerInfo[playerid][sync] = true;
998
    new PlayerWeapons[2][13];
999
    for(new i = 0; i < 13; i++) {
1000
        if(i == 0 || i == 1) {
1001
            GetPlayerWeaponData(playerid,i,PlayerWeapons[0][i],PlayerWeapons[1][i]);
1002
1003
            if(PlayerWeapons[1][i] > 1) {
1004
                PlayerWeapons[1][i] = 1;
1005
            }
1006
        }
1007
1008
        else {
1009
            GetPlayerWeaponData(playerid,i,PlayerWeapons[0][i],PlayerWeapons[1][i]);
1010
        }
1011
    }
1012
1013
    ClearAnimations(playerid);
1014
1015
    new Float:PlayerPos[3];
1016
    GetPlayerPos(playerid,PlayerPos[0],PlayerPos[1],PlayerPos[2]);
1017
1018
    new Float:health ;
1019
    GetPlayerHealth(playerid,health);
1020
    new TheInterior, VirtualWorld;
1021
    new Float:Angle;
1022
1023
    GetPlayerFacingAngle(playerid, Angle);
1024
    TheInterior = GetPlayerInterior(playerid);
1025
    VirtualWorld = GetPlayerVirtualWorld(playerid);
1026
1027
    OnPlayerSpawn(playerid);
1028
1029
    SetPlayerWorldBounds(playerid,9999.9,-9999.9,9999.9,-9999.9);
1030
    ResetPlayerWeapons(playerid);
1031
    SetPlayerHealth(playerid,health);
1032
    SetPlayerInterior(playerid,TheInterior);
1033
    SetPlayerVirtualWorld(playerid,VirtualWorld);
1034
    SetPlayerPos(playerid,PlayerPos[0],PlayerPos[1],PlayerPos[2]);
1035
1036
    for(new i = 0; i < 13; i++) {
1037
        if(PlayerWeapons[0][i] > 0) {
1038
            GivePlayerWeapon(playerid,PlayerWeapons[0][i],PlayerWeapons[1][i]);
1039
        }
1040
    }
1041
    return true;
1042
}
1043
1044
1045
public DestroyPickupEx(pickupid)
1046
{
1047
    DestroyPickup(pickupid);
1048
    armaPickup[pickupid] = 0;
1049
1050
    return pickupFerramentas[pickupid] = 0;
1051
}
1052
1053
1054
public checarPause()
1055
{
1056
    for(new j = 1, i = jogadoresLoop[0]; j  != jogadoresConectados+1; i = jogadoresLoop[j], j++) {
1057
1058
        if(GetPlayerState(i) && GetPlayerState(i) != 7 && !PlayerInfo[i][paused] && (GetPlayerPing(i) / 1000) < (gettime() - PlayerInfo[i][updatetime]) > 3) {
1059
            return CallRemoteFunction("OnPlayerCommandText", "is", i, "/offline");
1060
        }
1061
1062
        if(PlayerInfo[i][paused] && (gettime() - PlayerInfo[i][updatetime]) < 3) {
1063
            return CallRemoteFunction("OnPlayerCommandText", "is", i, "/online");
1064
        }
1065
    }
1066
    return true;
1067
}
1068
1069
1070
public iniciarSistema()
1071
{
1072
    selecionarOutraArea:
1073
    gangZoneAtual = random(circuitoArquivo); maximoAreas = 0;
1074
    if(!posicoesAreas[gangZoneAtual][0]) goto selecionarOutraArea;
1075
1076
    for(new i; i != sizeof(posicoesAreas); i++) {
1077
        if((posicoesAreas[i][0] && posicoesAreas[i][1]) && IsPointInRangeOfPoint(posicoesAreas[i][0], posicoesAreas[i][1], posicoesAreas[i][2], posicoesAreas[gangZoneAtual][0], posicoesAreas[gangZoneAtual][1],posicoesAreas[gangZoneAtual][2],150.0)) {
1078
            armazenarAreaAtual[maximoAreas][0] = posicoesAreas[i][0];
1079
            armazenarAreaAtual[maximoAreas][1] = posicoesAreas[i][1];
1080
            armazenarAreaAtual[maximoAreas][2] = posicoesAreas[i][2];
1081
            maximoAreas++;
1082
        }
1083
    }
1084
    if(maximoAreas < 5) goto selecionarOutraArea;
1085
1086
    printf("NOVA AREA INICIADA (id: %d/%d) (numero de spawns: %d) ", gangZoneAtual, circuitoArquivo, maximoAreas);
1087
1088
    static string[128];
1089
    SendClientMessageToAll(COLOR_LIGHTGREEN, "-InfoServer- Gerando o ranking da rodada, veja abaixo:");
1090
1091
    for(new x = 0 ; x != MAX_RANK; ++x) {
1092
        for(new j = 1, i = jogadoresLoop[0]; j  != jogadoresConectados+1; i = jogadoresLoop[j], j++) {
1093
            if(!jogadorNoRanking[i] && GetPlayerScore(i) > jogadorRanking[x]) {
1094
                if(jogadorRankingID[x] != -1) jogadorNoRanking[jogadorRankingID[x]] = false;
1095
                jogadorRanking[x] = GetPlayerScore(i);
1096
1097
                jogadorRankingID[x] = i;
1098
                jogadorNoRanking[i] = true;
1099
            }
1100
        }
1101
        if(jogadorRankingID[x] != -1) {
1102
            format(string, 128, "Colocação: [%02i] Jogador: %024s (%04d)",x+1, GetPlayerNick(jogadorRankingID[x]),GetPlayerScore(jogadorRankingID[x]));
1103
            SendClientMessageToAll(0xF060B3FF, string);
1104
        }
1105
    }
1106
1107
    for(new j = 1, i = jogadoresLoop[0]; j  != jogadoresConectados+1; i = jogadoresLoop[j], j++) {
1108
1109
        GivePlayerWeapon(i, 4, 800);
1110
        GivePlayerWeapon(i, 16, 1);
1111
1112
        GivePlayerWeapon(i, 25, 800);
1113
        GivePlayerWeapon(i, 34, 800);
1114
1115
        GivePlayerWeapon(i, 24, 800);
1116
1117
        SetPlayerHealth(i, 100.0);
1118
        SetPlayerScore(i, 0);
1119
1120
        jogadorNoRanking[i] = false;
1121
        jogadorRankingID[i] = -1;
1122
        jogadorRanking[i] = -1;
1123
1124
        new randomPos = random(maximoAreas);
1125
1126
        SetPlayerPos(i, armazenarAreaAtual[randomPos][0], armazenarAreaAtual[randomPos][1], armazenarAreaAtual[randomPos][2] + 1.5); SetPlayerPos(i, armazenarAreaAtual[randomPos][0], armazenarAreaAtual[randomPos][1], armazenarAreaAtual[randomPos][2] + 1.5);
1127
    }
1128
1129
    return true;
1130
}
1131
1132
1133
public atualizarContagem()
1134
{
1135
1136
    format(string_contar, sizeof(string_contar), "Tempo~g~: ~r~%03i~w~/600", totalContagem++);
1137
1138
    TextDrawSetString(tempoAtualRound, string_contar);
1139
1140
    if(totalContagem < 600) {
1141
        SetTimer("atualizarContagem", 888, false);
1142
    }
1143
1144
    else {
1145
        SetTimer("atualizarContagem", 888, false);
1146
        totalContagem = 0;
1147
        iniciarSistema();
1148
    }
1149
    return true;
1150
}
1151
1152
1153
//======================= [ Automaton ] ========================================
1154
1155
public OnPlayerCommandText(playerid, cmdtext[]) <estadoServidor:trancar>
1156
{
1157
    state (!strcmp(cmdtext, "/estado-servidor", true) && IsPlayerAdmin(playerid)) estadoServidor:destrancar;
1158
    return false;
1159
}
1160
1161
1162
public OnPlayerConnect(playerid) <estadoServidor:trancar>
1163
{
1164
    SendClientMessage(playerid,0x7E7EFBFF, "-LockServ- Desculpe o servidor está trancado, contate um administrador");
1165
    return Kick(playerid);
1166
}
1167
1168
1169
public OnPlayerUpdate(playerid) <estadoServidor:trancar>
1170
{
1171
    SendClientMessage(playerid,0x7E7EFBFF, "-LockServ- Desculpe o servidor está trancado,, contate um administrador");
1172
    return Kick(playerid);
1173
}
1174
1175
1176
/* ================== [ Funções ] ==============================================
1177
1178
    @ sscanf adaptada para o sevidor
1179
    @ Criado por Bruno da Silva
1180
    @ sscanf(input[], format[], varsoutput)
1181
1182
     - Input
1183
        Colocar a string para ser dividida conforme o format
1184
1185
     - Formato
1186
Formato para o destino das divisões da string
1187
1188
- varsoutput
1189
variáveis/arrays para destino
1190
1191
Formatações:
1192
Ainda não tem todas formatações, apenas as principais:
1193
1194
"s" string
1195
"z" string
1196
"d" numeros
1197
"i" numeros
1198
"u" jogadores por nome ou id
1199
1200
@ Criado dia  14 de agosto de 2011
1201
@ www.ips-team.blogspot.com
1202
1203
*/
1204
1205
sscanf(string[], formats[],{Float,_}
1206
:...)
1207
{
1208
    if((!string[0] || string[0] == '\1' && !string[1]) || (!formats[0] || formats[0] == '\1' && !formats[1])||numargs()-2 != strlen(formats)) return false;
1209
1210
    new ultimoCaractere = 0;
1211
1212
    for(new f; formats[f]; f++) {
1213
        switch(formats[f]) {
1214
1215
            case 'i','d':
1216
            {
1217
                new
1218
                    i = ultimoCaractere,
1219
                    valorArmazenar = 0;
1220
1221
                for( ; string[i] > ' '; ++i) {
1222
1223
                    if(('0' <= string[i] <= '9')) {
1224
                        valorArmazenar = (valorArmazenar * 10) + (string[i] - '0');
1225
                    }
1226
                    else if(string[i] != '-') {
1227
                        return false;
1228
                    }
1229
                }
1230
                setarg(f + 2, 0, string[ultimoCaractere] == '-' ? ~valorArmazenar + 1 : valorArmazenar );
1231
                ultimoCaractere = i + 1;
1232
            }
1233
1234
            case 's','z':
1235
            {
1236
                new i = ultimoCaractere;
1237
                for( ; string[i] > ' '; i++) {
1238
                    setarg(f + 2, i - ultimoCaractere, string[i]);
1239
                }
1240
                ultimoCaractere = i + 1;
1241
            }
1242
            case 'u', 'j':
1243
            {
1244
                new
1245
                    i = ultimoCaractere,
1246
                    nomeJogador[MAX_PLAYER_NAME],
1247
                    jogadorDigitado = 0,
1248
                    bool:isNumeric = true;
1249
1250
                for( ; string[i] > ' '; i++) {
1251
1252
                    if ('0' <= string[i] <= '9') {
1253
                        jogadorDigitado = (jogadorDigitado * 10) + (string[i] - '0');
1254
                    }
1255
                    else {
1256
                        isNumeric = false;
1257
                    }
1258
                }
1259
                if (isNumeric  && IsPlayerConnected(jogadorDigitado)) {
1260
                    setarg(f + 2, 0, jogadorDigitado);
1261
1262
                }
1263
                else {
1264
                    strcat(nomeJogador, string[ultimoCaractere], MAX_PLAYER_NAME);
1265
                    jogadorDigitado = GetPlayerByPartName(nomeJogador);
1266
                    setarg(f + 2, 0, jogadorDigitado);
1267
                }
1268
                ultimoCaractere = i;
1269
            }
1270
        }
1271
    }
1272
    return true;
1273
}
1274
1275
1276
/*
1277
    @ GetPlayerByPartName
1278
    @ Função:
1279
        Retorna o id do jogador através de uma parte do nome do mesmo
1280
1281
    @ GetPlayerByPartName(partedonome)
1282
        - partedonome
1283
            Parte do nome para ser buscado o jogador, caso não encontrar retorna INVALID PLAYER
1284
1285
    @ Criado por Bruno da Silva
1286
1287
*/
1288
1289
GetPlayerByPartName(sNome[])
1290
{
1291
    if (strlen(sNome) < 3) return INVALID_PLAYER_ID;
1292
    static sName[MAX_PLAYER_NAME];
1293
    for (new j = 1, i = jogadoresLoop[0]; j != jogadoresConectados + 1; i = jogadoresLoop[j], j++) {
1294
        GetPlayerName(i, sName, MAX_PLAYER_NAME);
1295
        if (strfind(sName, sNome, true)) {
1296
            return i;
1297
        }
1298
    }
1299
    return INVALID_PLAYER_ID;
1300
}
1301
1302
1303
/*
1304
    @ GetPlayerNick
1305
    @ Função:
1306
        Retorna o nome de um jogador através do id do mesmo
1307
1308
    @ GetPlayerNick(player)
1309
        - player
1310
            id do jogador para retornar o nome
1311
1312
    @ Criado por Bruno da Silva
1313
1314
*/
1315
1316
GetPlayerNick(player)
1317
{
1318
    static name[MAX_PLAYER_NAME];
1319
    GetPlayerName(player, name, sizeof(name));
1320
    return name;
1321
}
1322
1323
1324
//	split String to array multidimensional
1325
1326
split(const strsrc[], strdest[][], delimiter)
1327
{
1328
    new i, li;
1329
    new aNum;
1330
    new len;
1331
    while(i <= strlen(strsrc)) {
1332
        if(strsrc[i] == delimiter || i == strlen(strsrc)) {
1333
            len = strmid(strdest[aNum], strsrc, li, i, 128);
1334
            strdest[aNum][len] = 0, li = i+1, aNum++;
1335
        }
1336
        i++; continue;
1337
    }
1338
    return true;
1339
}
1340
1341
1342
IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range)
1343
{
1344
    x2 -= x,   y2 -= y,   z2 -= z;
1345
    return  25.0 < ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range);
1346
}
1347
1348
1349
CriarArquivo(arquivo[])
1350
{
1351
    if(fexist(arquivo)) return false;
1352
    new File:Arquivo = fopen(arquivo, io_write);
1353
    return fclose(Arquivo);
1354
}