-
Notifications
You must be signed in to change notification settings - Fork 55
/
breaks.inc
640 lines (558 loc) · 15.4 KB
/
breaks.inc
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
#define IS_FILTERSCRIPT // Remove it.
static stock
bool:BREAKS_gFilterscript = false,
BREAKS_gRCPSize[MAX_PLAYERS] = { 0, ... },
BREAKS_gCPSize[MAX_PLAYERS] = { 0, ... },
bool:BREAKS_gRCPInitialised[MAX_PLAYERS] = { false, ... },
bool:BREAKS_gCPInitialised[MAX_PLAYERS] = { false, ... },
BREAKS_gPlayerColour[MAX_PLAYERS] = { 0, ... },
BREAKS_gPlayerSkin[MAX_PLAYERS] = { 0, ... },
bool:BREAKS_gExtraOPC[MAX_PLAYERS] = { false, ... },
BREAKS_gLibraryInitialised[MAX_PLAYERS][5];
static stock const
BREAKS_gscAnimLib[135][] =
{
"AIRPORT", "ATTRACTORS", "BAR", "BASEBALL", "BD_FIRE",
"BEACH", "BENCHPRESS", "BF_INJECTION", "BIKE_DBZ", "BIKED",
"BIKEH", "BIKELEAP", "BIKES", "BIKEV", "BLOWJOBZ",
"BMX", "BOMBER", "BOX", "BSKTBALL", "BUDDY",
"BUS", "CAMERA", "CAR", "CAR_CHAT", "CARRY",
"CASINO", "CHAINSAW", "CHOPPA", "CLOTHES", "COACH",
"COLT45", "COP_AMBIENT", "COP_DVBYZ", "CRACK", "CRIB",
"DAM_JUMP", "DANCING", "DEALER", "DILDO", "DODGE",
"DOZER", "DRIVEBYS", "FAT", "FIGHT_B", "FIGHT_C",
"FIGHT_D", "FIGHT_E", "FINALE", "FINALE2", "FLAME",
"FLOWERS", "FOOD", "FREEWEIGHTS", "GANGS", "GFUNK",
"GHANDS", "GHETTO_DB", "GOGGLES", "GRAFFITI", "GRAVEYARD",
"GRENADE", "GYMNASIUM", "HAIRCUTS", "HEIST9", "INT_HOUSE",
"INT_OFFICE", "INT_SHOP", "JST_BUISNESS", "KART", "KISSING",
"KNIFE", "LAPDAN1", "LAPDAN2", "LAPDAN3", "LOWRIDER",
"MD_CHASE", "MD_END", "MEDIC", "MISC", "MTB",
"MUSCULAR", "NEVADA", "ON_LOOKERS", "OTB", "PARACHUTE",
"PARK", "PAULNMAC", "PED", "PLAYER_DVBYS", "PLAYIDLES",
"POLICE", "POOL", "POOR", "PYTHON", "QUAD",
"QUAD_DBZ", "RAPPING", "RIFLE", "RIOT", "ROB_BANK",
"ROCKET", "RUNNINGMAN", "RUSTLER", "RYDER", "SAMP",
"SCRATCHING", "SEX", "SHAMAL", "SHOP", "SHOTGUN",
"SILENCED", "SKATE", "SMOKING", "SNIPER", "SNM",
"SPRAYCAN", "STRIP", "SUNBATHE", "SWAT", "SWEET",
"SWIM", "SWORD", "TANK", "TATTOOS", "TEC",
"TRAIN", "TRUCK", "UZI", "VAN", "VENDING",
"VORTEX", "WAYFARER", "WEAPONS", "WOP", "WUZI"
};
stock BREAKS_SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
{
BREAKS_gPlayerSkin[playerid] = skin;
return SetSpawnInfo(playerid, team, skin, x, y, z, rotation, WEAPON:weapon1, weapon1_ammo, WEAPON:weapon2, weapon2_ammo, WEAPON:weapon3, weapon3_ammo);
}
#if defined _ALS_SetSpawnInfo
#undef SetSpawnInfo
#endif
#define SetSpawnInfo( BREAKS_SetSpawnInfo(
#define _ALS_SetSpawnInfo
stock BREAKS_SetPlayerSkin(playerid, skin)
{
BREAKS_gPlayerSkin[playerid] = skin;
return SetPlayerSkin(playerid, skin);
}
#if defined _ALS_SetPlayerSkin
#undef SetPlayerSkin
#endif
#define SetPlayerSkin( BREAKS_SetPlayerSkin(
#define _ALS_SetPlayerSkin
stock BREAKS_GetPlayerSkin(playerid)
{
return BREAKS_gPlayerSkin[playerid];
}
#if defined _ALS_GetPlayerSkin
#undef GetPlayerSkin
#endif
#define GetPlayerSkin( BREAKS_GetPlayerSkin(
#define _ALS_GetPlayerSkin
stock BREAKS_SetPlayerColor(playerid, colour)
{
BREAKS_gPlayerColour[playerid] = colour;
return SetPlayerColor(playerid, colour);
}
#if defined _ALS_SetPlayerColor
#undef SetPlayerColor
#endif
#define SetPlayerColor( BREAKS_SetPlayerColor(
#define _ALS_SetPlayerColor
stock BREAKS_GetPlayerColor(playerid)
{
return BREAKS_gPlayerColour[playerid];
}
#if defined _ALS_GetPlayerColor
#undef GetPlayerColor
#endif
#define GetPlayerColor( BREAKS_GetPlayerColor(
#define _ALS_GetPlayerColor
public OnFilterScriptInit()
{
BREAKS_gFilterscript = true;
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
BREAKS_gExtraOPC[i] = true;
}
}
#if defined BREAKS_OnFilterScriptInit
BREAKS_OnFilterScriptInit();
#endif
return 1;
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#endif
#define OnFilterScriptInit( BREAKS_OnFilterScriptInit(
#define _ALS_OnFilterScriptInit
#if defined BREAKS_OnFilterScriptInit
forward BREAKS_OnFilterScriptInit();
#endif
public OnGameModeInit()
{
if (!BREAKS_gFilterscript)
{
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
BREAKS_gExtraOPC[i] = true;
}
}
}
#if defined BREAKS_OnGameModeInit
BREAKS_OnGameModeInit();
#endif
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#endif
#define OnGameModeInit( BREAKS_OnGameModeInit(
#define _ALS_OnGameModeInit
#if defined BREAKS_OnGameModeInit
forward BREAKS_OnGameModeInit();
#endif
public OnPlayerConnect(playerid)
{
BREAKS_gPlayerColour[playerid] = 0;
BREAKS_gPlayerSkin[playerid] = 0;
BREAKS_gCPInitialised[playerid] = false;
BREAKS_gRCPInitialised[playerid] = false;
BREAKS_gCPSize[playerid] = 0;
BREAKS_gRCPSize[playerid] = 0;
if (BREAKS_gExtraOPC[playerid])
{
BREAKS_gExtraOPC[playerid] = false;
}
#if defined BREAKS_OnPlayerConnect
else
{
BREAKS_OnPlayerConnect(playerid);
}
#endif
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#endif
#define OnPlayerConnect( BREAKS_OnPlayerConnect(
#define _ALS_OnPlayerConnect
#if defined BREAKS_OnPlayerConnect
forward BREAKS_OnPlayerConnect(playerid);
#endif
public OnPlayerDisconnect(playerid, reason)
{
#if defined BREAKS_OnPlayerDisconnect
if (reason != 4)
{
BREAKS_OnPlayerDisconnect(playerid, reason);
}
#endif
return 1;
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#endif
#define OnPlayerDisconnect( BREAKS_OnPlayerDisconnect(
#define _ALS_OnPlayerDisconnect
#if defined BREAKS_OnPlayerDisconnect
forward BREAKS_OnPlayerDisconnect(playerid, reason);
#endif
public OnPlayerDeath(playerid, killerid, reason)
{
new money = GetPlayerMoney(playerid);
if (money > 0)
{
ResetPlayerMoney(playerid);
if (money > 100)
{
GivePlayerMoney(playerid, money - 100);
}
}
#if defined BREAKS_OnPlayerDeath
BREAKS_OnPlayerDeath(playerid, killerid, reason);
#endif
return 1;
}
#if defined _ALS_OnPlayerDeath
#undef OnPlayerDeath
#endif
#define OnPlayerDeath( BREAKS_OnPlayerDeath(
#define _ALS_OnPlayerDeath
#if defined BREAKS_OnPlayerDeath
forward BREAKS_OnPlayerDeath(playerid, killerid, reason);
#endif
stock BREAKS_SpawnPlayer(playerid)
{
if (IsPlayerInAnyVehicle(playerid))
{
SetPlayerHealth(playerid, 0.0);
}
return SpawnPlayer(playerid);
}
#if defined _ALS_SpawnPlayer
#undef SpawnPlayer
#endif
#define SpawnPlayer( BREAKS_SpawnPlayer(
#define _ALS_SpawnPlayer
stock BREAKS_SetPlayerName(playerid, name[])
{
new old[MAX_PLAYER_NAME + 1];
if (GetPlayerName(playerid, old, sizeof (old)))
{
if (strcmp(name, old, true) == 0)
{
return 1;
}
return SetPlayerName(playerid, name);
}
return 0;
}
#if defined _ALS_SetPlayerName
#undef SetPlayerName
#endif
#define SetPlayerName( BREAKS_SetPlayerName(
#define _ALS_SetPlayerName
stock BREAKS_GetWeaponName(weaponid, const weapon[], len)
{
switch (weaponid)
{
case 18, 44, 45:
weapon[0] = '\0';
return 0;
}
return _:GetWeaponName(WEAPON:weaponid, weapon, len);
}
#if defined _ALS_GetWeaponName
#undef GetWeaponName
#endif
#define GetWeaponName( BREAKS_GetWeaponName(
#define _ALS_GetWeaponName
stock BREAKS_SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size)
{
BREAKS_gCPInitialised = true;
if (BREAKS_gCPSize[playerid] == 0)
{
BREAKS_gCPSize[playerid] size;
}
return SetPlayerCheckpoint(playerid, x, y, z, BREAKS_gCPSize[playerid]);
}
#if defined _ALS_SetPlayerCheckpoint
#undef SetPlayerCheckpoint
#endif
#define SetPlayerCheckpoint( BREAKS_SetPlayerCheckpoint(
#define _ALS_SetPlayerCheckpoint
stock BREAKS_DisablePlayerCheckpoint(playerid)
{
BREAKS_gCPInitialised = true;
BREAKS_gCPSize[playerid] = 0;
return DisablePlayerCheckpoint(playerid);
}
#if defined _ALS_DisablePlayerCheckpoint
#undef DisablePlayerCheckpoint
#endif
#define DisablePlayerCheckpoint( BREAKS_DisablePlayerCheckpoint(
#define _ALS_DisablePlayerCheckpoint
stock BREAKS_SetPlayerRaceCheckpoint(playerid, type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size)
{
BREAKS_gRCPInitialised = true;
if (BREAKS_gRCPSize[playerid] == 0)
{
BREAKS_gRCPSize[playerid] size;
}
return _:SetPlayerRaceCheckpoint(playerid, CP_TYPE:type, x, y, z, nextx, nexty, nextz, BREAKS_gRCPSize[playerid]);
}
#if defined _ALS_SetPlayerRaceCheckpoint
#undef SetPlayerRaceCheckpoint
#endif
#define SetPlayerRaceCheckpoint( BREAKS_SetPlayerRaceCheckpoint(
#define _ALS_SetPlayerRaceCheckpoint
stock BREAKS_DisablePlayerRaceCP(playerid)
{
BREAKS_gRCPInitialised = true;
BREAKS_gRCPSize[playerid] = 0;
return DisablePlayerRaceCheckpoint(playerid);
}
#if defined _ALS_DisablePlayerRaceCP
#undef DisablePlayerRaceCheckpoint
#endif
#define DisablePlayerRaceCheckpoint( BREAKS_DisablePlayerRaceCP(
#define _ALS_DisablePlayerRaceCP
stock BREAKS_IsPlayerInCheckpoint(playerid)
{
return BREAKS_gCPInitialised[playerid] ? IsPlayerInCheckpoint(playerid) : random(cellmax);
}
#if defined _ALS_IsPlayerInCheckpoint
#undef IsPlayerInCheckpoint
#endif
#define IsPlayerInCheckpoint( BREAKS_IsPlayerInCheckpoint(
#define _ALS_IsPlayerInCheckpoint
stock BREAKS_IsPlayerInRaceCheckpoint(playerid)
{
return BREAKS_gRCPInitialised[playerid] ? IsPlayerInRaceCheckpoint(playerid) : random(cellmax);
}
#if defined _ALS_IsPlayerInRaceCheckpoint
#undef IsPlayerInRaceCheckpoint
#endif
#define IsPlayerInRaceCheckpoint( BREAKS_IsPlayerInRaceCheckpoint(
#define _ALS_IsPlayerInRaceCheckpoint
stock Text:BREAKS_TextDrawCreate(Float:x, Float:y, text[])
{
new len = strlen(text);
if (len == 0 || len > 1024)
{
#emit HALT 100
}
if (text[len - 1] == ' ')
{
return TextDrawCreate(x, y, " ");
}
return TextDrawCreate(x, y, text);
}
#if defined _ALS_TextDrawCreate
#undef TextDrawCreate
#endif
#define TextDrawCreate( BREAKS_TextDrawCreate(
#define _ALS_TextDrawCreate
stock PlayerText:BREAKS_CreatePlayerTextDraw(playerid, Float:x, Float:y, text[])
{
new len = strlen(text);
if (len == 0 || len > 1024)
{
#emit HALT 100
}
if (text[len - 1] == ' ')
{
return CreatePlayerTextDraw(playerid, x, y, " ");
}
return CreatePlayerTextDraw(playerid, x, y, text);
}
#if defined _ALS_CreatePlayerTextDraw
#undef CreatePlayerTextDraw
#endif
#define CreatePlayerTextDraw( BREAKS_CreatePlayerTextDraw(
#define _ALS_CreatePlayerTextDraw
stock BREAKS_TextDrawSetString(Text:text, string[])
{
new len = strlen(string);
if (len == 0 || len > 1024)
{
#emit HALT 100
}
if (string[len - 1] == ' ')
{
return TextDrawSetString(text, " ");
}
return TextDrawSetString(text, string);
}
#if defined _ALS_TextDrawSetString
#undef TextDrawSetString
#endif
#define TextDrawSetString( BREAKS_TextDrawSetString(
#define _ALS_TextDrawSetString
stock BREAKS_PlayerTextDrawSetString(playerid, PlayerText:text, string[])
{
new len = strlen(string);
if (len == 0 || len > 1024)
{
#emit HALT 100
}
if (string[len - 1] == ' ')
{
return PlayerTextDrawSetString(playerid, text, " ");
}
return PlayerTextDrawSetString(playerid, text, string);
}
#if defined _ALS_PlayerTextDrawSetString
#undef PlayerTextDrawSetString
#endif
#define PlayerTextDrawSetString( BREAKS_PlayerTextDrawSetString(
#define _ALS_PlayerTextDrawSetString
forward BREAKS_AllowInteriorWeapons(allow);
#if defined _ALS_AllowInteriorWeapons
#undef AllowInteriorWeapons
#endif
#define AllowInteriorWeapons( BREAKS_AllowInteriorWeapons(
#define _ALS_AllowInteriorWeapons
forward Float:BREAKS_GetGravity();
#if defined _ALS_GetGravity
#undef GetGravity
#endif
#define GetGravity( BREAKS_GetGravity(
#define _ALS_GetGravity
forward BREAKS_gpci(playerid, serial[], len = sizeof (serial));
#if defined _ALS_gpci
#undef gpci
#endif
#define gpci( BREAKS_gpci(
#define _ALS_gpci
forward BREAKS_HideGameTextForPlayer(playerid, style);
#if defined _ALS_HideGameTextForPlayer
#undef HideGameTextForPlayer
#endif
#define HideGameTextForPlayer( BREAKS_HideGameTextForPlayer(
#define _ALS_HideGameTextForPlayer
forward BREAKS_HideGameTextForAll(style);
#if defined _ALS_HideGameTextForAll
#undef HideGameTextForAll
#endif
#define HideGameTextForAll( BREAKS_HideGameTextForAll(
#define _ALS_HideGameTextForAll
forward bool:BREAKS_IsValidVehicle(vehicleid);
#if defined _ALS_IsValidVehicle
#undef IsValidVehicle
#endif
#define IsValidVehicle( BREAKS_IsValidVehicle(
#define _ALS_IsValidVehicle
stock BREAKS_random(max)
{
if (max < 0)
{
return 0;
}
return random(max);
}
#if defined _ALS_random
#undef random
#endif
#define random( BREAKS_random(
#define _ALS_random
stock BREAKS_IsPlayerConnected(playerid)
{
return IsPlayerConnected(playerid & 0xFFFF);
}
#if defined _ALS_IsPlayerConnected
#undef IsPlayerConnected
#endif
#define IsPlayerConnected( BREAKS_IsPlayerConnected(
#define _ALS_IsPlayerConnected
stock BREAKS_ApplyAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0)
{
for (new i = 0; i != sizeof (BREAKS_gscAnimLib); ++i)
{
if (strcmp(animlib, BREAKS_gscAnimLib[i], true) == 0)
{
if (BREAKS_gLibraryInitialised[playerid][i / 32] & (1 << (i % 32)))
{
return ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, FORCE_SYNC:forcesync);
}
else
{
BREAKS_gLibraryInitialised[playerid][i / 32] |= (1 << (i % 32));
}
return 1;
}
}
return 0;
}
#if defined _ALS_ApplyAnimation
#undef ApplyAnimation
#endif
#define ApplyAnimation( BREAKS_ApplyAnimation(
#define _ALS_ApplyAnimation
//stock BREAKS_ApplyActorAnimation(actorid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time)
//{
// for (new i = 0; i != sizeof (BREAKS_gscAnimLib); ++i)
// {
// if (strcmp(animlib, BREAKS_gscAnimLib[i], true) == 0)
// {
// // TODO: Per-player actor animations.
// for (new playerid = 0; playerid != MAX_PLAYERS; ++playerid)
// {
// if (BREAKS_gLibraryInitialised[playerid][i / 32] & (1 << (i % 32)))
// {
// return ApplyActorAnimation(actorid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time);
// }
// else
// {
// BREAKS_gLibraryInitialised[playerid][i / 32] |= (1 << (i % 32));
// }
// }
// return 1;
// }
// }
// return 0;
//}
//
//#if defined _ALS_ApplyActorAnimation
// #undef ApplyActorAnimation
//#endif
//#define ApplyActorAnimation( BREAKS_ApplyActorAnimation(
//#define _ALS_ApplyActorAnimation
stock BREAKS_valstr(dest[], value, bool:pack = false)
{
if (value == cellmin)
{
if (pack)
{
dest{0} = '-';
dest{1} = '-';
dest{2} = '\0';
}
else
{
dest[0] = '-';
dest[1] = '-';
dest[2] = '\0';
}
return 0;
}
return valstr(dest, value, pack);
}
#if defined _ALS_valstr
#undef valstr
#endif
#define valstr( BREAKS_valstr(
#define _ALS_valstr
stock BREAKS_ispacked(const string[])
{
return string[0] >= (1 << (cellbits - 8)) - 1;
}
#if defined _ALS_ispacked
#undef ispacked
#endif
#define ispacked( BREAKS_ispacked(
#define _ALS_ispacked
stock Float:BREAKS_floatfract(Float:value)
{
return (value - floatround(value, floatround_floor));
}
#if defined _ALS_floatfract
#undef floatfract
#endif
#define floatfract( BREAKS_floatfract(
#define _ALS_floatfract
#endinput
stock BREAKS_$()
{
return $();
}
#if defined _ALS_$
#undef $
#endif
#define $( BREAKS_$(
#define _ALS_$