/
ScavengeSurvive.pwn
615 lines (504 loc) · 20.3 KB
/
ScavengeSurvive.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
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
/*==============================================================================
Southclaws' Scavenge and Survive
Big thanks to Onfire559/Adam for the initial concept and developing
the idea a lot long ago with some very productive discussions!
Recently influenced by Minecraft and DayZ, credits to the creators of
those games and their fundamental mechanics and concepts.
Copyright (C) 2017 Barnaby "Southclaws" Keene
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
==============================================================================*/
#include <a_samp>
// Redefines MAX_PLAYERS constant before usage
#undef MAX_PLAYERS
#define MAX_PLAYERS (32)
#include <logger>
native IsValidVehicle(vehicleid); // undefined native
native gpci(playerid, serial[], len); // undefined native
native WP_Hash(buffer[], len, const str[]); // Southclaws/samp-whirlpool
#define _DEBUG 0 // YSI
#define ITER_NONE (cellmin) // Temporary fix for https://github.com/Misiur/YSI-Includes/issues/109
#define STRLIB_RETURN_SIZE (256) // strlib
#define MODIO_DEBUG (0) // modio
#define MODIO_FILE_STRUCTURE_VERSION (20) // modio
#define MODIO_SCRIPT_EXIT_FIX (1) // modio
#define BTN_TELEPORT_FREEZE_TIME (3000) // SIF/Button
#define INV_MAX_SLOTS (6) // SIF/Inventory
#define ITM_ARR_ARRAY_SIZE_PROTECT (false) // SIF/extensions/ItemArrayData
#define ITM_MAX_TYPES (ItemType:300) // SIF/Item
#define ITM_MAX_NAME (20) // SIF/Item
#define ITM_MAX_TEXT (64) // SIF/Item
#define ITM_DROP_ON_DEATH (false) // SIF/Item
#if defined BUILD_MINIMAL
#define MAX_BUTTON (4096) // SIF/Button
#define MAX_ITEM (4096) // SIF/Item
#define MAX_CONTAINER_SLOTS (100)
#define MAX_MODIO_STACK_SIZE (1024)
#define MAX_MODIO_SESSION (2)
#else
#define MAX_BUTTON (32768) // SIF/Button
#define MAX_ITEM (32768) // SIF/Item
#define MAX_CONTAINER_SLOTS (100)
#define MAX_MODIO_SESSION (2048) // modio
#endif
/*==============================================================================
Guaranteed first call
Note: This is not tested in YSI 4.x or 5.x branches! As a result, the below
claim may not be true any more!
-
OnGameModeInit_Setup is called before ANYTHING else, the purpose of this is
to prepare various internal and external systems that may need to be ready
for other modules to use their functionality. This function isn't hooked.
OnScriptInit (from YSI) is then called through modules which is used to
prepare dependencies such as databases, folders and register debuggers.
OnGameModeInit is then finally called throughout modules and starts inside
the "Server/Init.pwn" module (very important) so itemtypes and other object
types can be defined. This callback is used throughout other scripts as a
means for declaring entities with relevant data.
==============================================================================*/
// Must include y_utils before this hook (not quite a "guaranteed" first call any more!)
// due to https://github.com/Misiur/YSI-Includes/issues/196
#include <YSI\y_utils>
public OnGameModeInit()
{
print("[OnGameModeInit] Initialising 'Main'...");
OnGameModeInit_Setup();
#if defined main_OnGameModeInit
return main_OnGameModeInit();
#else
return 1;
#endif
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit main_OnGameModeInit
#if defined main_OnGameModeInit
forward main_OnGameModeInit();
#endif
#include "sss\core\server\hooks.pwn" // preload library for hooking functions before they are used in external libraries.
#include <crashdetect> // Zeex/samp-plugin-crashdetect
#include <sscanf2> // maddinat0r/sscanf
#include <YSI\y_colours> // pawn-lang/YSI-Includes
#include <YSI\y_va> // pawn-lang/YSI-Includes
#include <YSI\y_timers> // pawn-lang/YSI-Includes
#include <YSI\y_iterate> // pawn-lang/YSI-Includes
#include <YSI\y_ini> // pawn-lang/YSI-Includes
#include <streamer> // samp-incognito/samp-streamer-plugin
#include <formatex> // Southclaws/formatex
#include <strlib> // oscar-broman/strlib
#include <easyDialog> // Awsomedude/easyDialog
#include <ctime> // Southclaws/samp-ctime
#include <chrono> // Southclaws/pawn-chrono
#include <progress2> // Southclaws/progress2
#include <mapandreas> // Southclaws/samp-plugin-mapandreas
#include <ini> // Southclaws/samp-ini
#include <modio> // Southclaws/modio
#include <fsutil> // Southclaws/pawn-fsutil
#include <requests> // Southclaws/pawn-requests
#include <mathutil> // ScavengeSurvive/mathutil
#include <settings> // ScavengeSurvive/settings
#include <language> // ScavengeSurvive/language
#include <chat> // ScavengeSurvive/chat
#include <item> // ScavengeSurvive/item
#include <container> // ScavengeSurvive/container
#include <bag> // ScavengeSurvive/bag
#include <inventory> // ScavengeSurvive/inventory
// must re-initialise y_hooks after the above packages
#include <YSI\y_hooks> // pawn-lang/YSI-Includes
// -
// Definitions
// -
// Limits
#define MAX_MOTD_LEN (128)
#define MAX_WEBSITE_NAME (64)
#define MAX_RULE (24)
#define MAX_RULE_LEN (128)
#define MAX_STAFF (24)
#define MAX_STAFF_LEN (24)
#define MAX_PLAYER_FILE (MAX_PLAYER_NAME+16)
#define MAX_ADMIN (48)
#define MAX_PASSWORD_LEN (129)
#define MAX_GPCI_LEN (41)
#define MAX_HOST_LEN (256)
// Files etc
#define DIRECTORY_SCRIPTFILES "./scriptfiles/"
#define DIRECTORY_MAIN "data/"
#define SETTINGS_FILE DIRECTORY_MAIN"settings.ini"
// Helper Macros
#define HOLDING(%0) ((newkeys & (%0)) == (%0))
#define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define IsValidPlayerID(%0) (0<=%0<MAX_PLAYERS)
new stock
gBuildNumber = {{ file.Read "./BUILD_NUMBER" }},
bool: gServerInitialising = true,
gServerInitialiseTick,
bool: gServerRestarting = false,
gServerMaxUptime,
gServerUptime;
new
RequestsClient:Store,
Request:StorePingRequest;
// settings.ini variables
new
gMessageOfTheDay[MAX_MOTD_LEN],
gWebsiteURL[MAX_WEBSITE_NAME],
gRuleList[MAX_RULE][MAX_RULE_LEN],
gTotalRules,
gStaffList[MAX_STAFF][MAX_STAFF_LEN],
gTotalStaff,
bool: gPauseMap,
bool: gInteriorEntry,
bool: gVehicleSurfing,
Float: gNameTagDistance,
gCombatLogWindow,
gLoginFreezeTime,
gMaxTaboutTime,
gPingLimit,
gCrashOnExit;
// -
// Modules
// -
// Pre-hook API
#tryinclude "sss/extensions/ext_pre.pwn"
// Utilities
#include "sss/utils/colours.pwn"
#include "sss/utils/misc.pwn"
#include "sss/utils/vehicle.pwn"
#include "sss/utils/vehicle-data.pwn"
#include "sss/utils/vehicle-parts.pwn"
#include "sss/utils/zones.pwn"
#include "sss/utils/player.pwn"
#include "sss/utils/object.pwn"
#include "sss/utils/string.pwn"
#include "sss/utils/item.pwn"
#include "sss/utils/headoffsets.pwn"
#include "sss/utils/status.pwn"
// Server
// #include "sss/core/server/save-block.pwn"
// #include "sss/core/server/info-message.pwn"
// #include "sss/core/server/loot.pwn"
// #include "sss/core/server/init.pwn"
#include "sss/core/server/language.pwn"
// Player
#include "sss/core/player/account/account.pwn"
#include "sss/core/player/account/register.pwn"
#include "sss/core/player/account/login.pwn"
#include "sss/core/player/account/logout.pwn"
#include "sss/core/player/core.pwn"
// -
// Libraries that have not been migrated yet
// -
// #include "sss/core/vehicle/vehicle-type.pwn"
// #include "sss/core/vehicle/lock.pwn"
// #include "sss/core/vehicle/core.pwn"
// #include "sss/core/player/core.pwn"
// #include "sss/core/player/save-load.pwn"
// #include "sss/core/admin/core.pwn"
// #include "sss/core/item/liquid.pwn"
// #include "sss/core/item/liquid-container.pwn"
// #include "sss/core/world/tree.pwn"
// #include "sss/core/world/explosive.pwn"
// #include "sss/core/world/craft-construct.pwn"
// #include "sss/core/world/loot-loader.pwn"
// VEHICLE
// #include "sss/core/vehicle/player-vehicle.pwn"
// #include "sss/core/vehicle/loot-vehicle.pwn"
// #include "sss/core/vehicle/spawn.pwn"
// #include "sss/core/vehicle/interact.pwn"
// #include "sss/core/vehicle/trunk.pwn"
// #include "sss/core/vehicle/repair.pwn"
// #include "sss/core/vehicle/lock-break.pwn"
// #include "sss/core/vehicle/locksmith.pwn"
// #include "sss/core/vehicle/carmour.pwn"
// #include "sss/core/vehicle/anti-ninja.pwn"
// #include "sss/core/vehicle/bike-collision.pwn"
// #include "sss/core/vehicle/trailer.pwn"
// PLAYER INTERNAL SCRIPTS
// #include "sss/core/player/brightness.pwn"
// #include "sss/core/player/spawn.pwn"
// #include "sss/core/player/death.pwn"
// #include "sss/core/player/tutorial.pwn"
// #include "sss/core/player/welcome-message.pwn"
// #include "sss/core/player/cmd-process.pwn"
// #include "sss/core/player/commands.pwn"
// #include "sss/core/player/disallow-actions.pwn"
// #include "sss/core/player/whitelist.pwn"
// #include "sss/core/player/country.pwn"
// #include "sss/core/player/radio.pwn"
// #include "sss/core/player/key-actions.pwn"
// #include "sss/core/player/status.pwn"
// ADMINISTRATION TOOLS
// #include "sss/core/admin/report.pwn"
// #include "sss/core/admin/report-io.pwn"
// #include "sss/core/admin/report-cmds.pwn"
// #include "sss/core/admin/hack-detect.pwn"
// #include "sss/core/admin/hack-trap.pwn"
// #include "sss/core/admin/ban.pwn"
// #include "sss/core/admin/ban-io.pwn"
// #include "sss/core/admin/ban-command.pwn"
// #include "sss/core/admin/ban-list.pwn"
// #include "sss/core/admin/spectate.pwn"
// #include "sss/core/admin/level1.pwn"
// #include "sss/core/admin/level2.pwn"
// #include "sss/core/admin/level3.pwn"
// #include "sss/core/admin/level4.pwn"
// #include "sss/core/admin/level5.pwn"
// #include "sss/core/admin/bug-report.pwn"
// // #include "sss/core/admin/detfield.pwn"
// // #include "sss/core/admin/detfield-io.pwn"
// // #include "sss/core/admin/detfield-cmds.pwn"
// // #include "sss/core/admin/detfield-draw.pwn"
// #include "sss/core/admin/rcon.pwn"
// #include "sss/core/admin/freeze.pwn"
// #include "sss/core/admin/name-tags.pwn"
// #include "sss/core/admin/player-list.pwn"
// ITEMS
// #include "sss/core/item/food.pwn"
// #include "sss/core/item/firework.pwn"
// #include "sss/core/item/shield.pwn"
// #include "sss/core/item/handcuffs.pwn"
// #include "sss/core/item/wheel.pwn"
// #include "sss/core/item/headlight.pwn"
// #include "sss/core/item/pills.pwn"
// #include "sss/core/item/dice.pwn"
// #include "sss/core/item/armour.pwn"
// #include "sss/core/item/injector.pwn"
// #include "sss/core/item/parachute.pwn"
// #include "sss/core/item/molotov.pwn"
// #include "sss/core/item/screwdriver.pwn"
// #include "sss/core/item/torso.pwn"
// #include "sss/core/item/ammotin.pwn"
// #include "sss/core/item/campfire.pwn"
// #include "sss/core/item/herpderp.pwn"
// #include "sss/core/item/stungun.pwn"
// #include "sss/core/item/note.pwn"
// #include "sss/core/item/seedbag.pwn"
// #include "sss/core/item/plantpot.pwn"
// #include "sss/core/item/heartshapedbox.pwn"
// #include "sss/core/item/fishingrod.pwn"
// #include "sss/core/item/chainsaw.pwn"
// #include "sss/core/item/locator.pwn"
// #include "sss/core/item/locker.pwn"
// ITEMS (HATS/MASKS)
// #include "sss/core/item/armyhelm.pwn"
// #include "sss/core/item/cowboyhat.pwn"
// #include "sss/core/item/truckcap.pwn"
// #include "sss/core/item/boaterhat.pwn"
// #include "sss/core/item/bowlerhat.pwn"
// #include "sss/core/item/policecap.pwn"
// #include "sss/core/item/tophat.pwn"
// #include "sss/core/item/bandana.pwn"
// #include "sss/core/item/xmashat.pwn"
// #include "sss/core/item/witcheshat.pwn"
// #include "sss/core/item/policehelm.pwn"
// #include "sss/core/item/zorromask.pwn"
// #include "sss/core/item/gasmask.pwn"
// #include "sss/core/item/hockeymask.pwn"
// POST-CODE
// #include "sss/core/server/auto-save.pwn"
// #tryinclude "sss/extensions/ext_post.pwn"
// WORLD
// #if defined BUILD_MINIMAL
// #include "sss/world-bs/world.pwn"
// #else
// #include "sss/world/world.pwn"
// #endif
// #if !defined GetMapName
// #error World script MUST have a "GetMapName" function!
// #endif
// #if !defined GenerateSpawnPoint
// #error World script MUST have a "GenerateSpawnPoint" function!
// #endif
main() {
log("================================================================================");
log(" Southclaws' Scavenge and Survive");
log(" Copyright (C) 2016 Barnaby \"Southclaws\" Keene");
log(" This program comes with ABSOLUTELY NO WARRANTY; This is free software,");
log(" and you are welcome to redistribute it under certain conditions.");
log(" Please see <http://www.gnu.org/copyleft/gpl.html> for details.");
log("================================================================================");
gServerInitialising = false;
gServerInitialiseTick = GetTickCount();
}
static Text:RestartCount = Text:INVALID_TEXT_DRAW;
OnGameModeInit_Setup() {
// todo: fsutil ReadFile impl
// new buildstring[12];
// ReadFile("BUILD_NUMBER", buildstring);
// gBuildNumber = strval(buildstring);
// if(gBuildNumber < 1000) {
// fatal("build number < 1000",
// _i("build", gBuildNumber));
// }
log("initialising Scavenge and Survive",
_i("build", gBuildNumber));
Streamer_ToggleErrorCallback(true);
MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
UsePlayerPedAnims();
CreateDirIfNotExists(DIRECTORY_SCRIPTFILES);
CreateDirIfNotExists(DIRECTORY_SCRIPTFILES DIRECTORY_MAIN);
new
storeEndpoint[128],
storeKey[128];
GetSettingString(SETTINGS_FILE, "server/store/endpoint", "http://localhost:7788", storeEndpoint);
GetSettingString(SETTINGS_FILE, "server/store/key", "secret_key", storeKey);
GetSettingString(SETTINGS_FILE, "server/motd", "Please update the 'server/motd' string in "SETTINGS_FILE"", gMessageOfTheDay);
GetSettingString(SETTINGS_FILE, "server/website", "southclawjk.wordpress.com", gWebsiteURL);
GetSettingInt(SETTINGS_FILE, "server/crash-on-exit", true, gCrashOnExit);
GetSettingStringArray(SETTINGS_FILE, "server/rules", "Please update the 'server/rules' array in '"SETTINGS_FILE"'.", gRuleList, gTotalRules, 128, MAX_RULE, MAX_RULE_LEN);
GetSettingStringArray(SETTINGS_FILE, "server/staff", "StaffName", gStaffList, gTotalStaff, 32, MAX_STAFF, MAX_STAFF_LEN);
GetSettingInt(SETTINGS_FILE, "server/max-uptime", 18000, gServerMaxUptime);
GetSettingInt(SETTINGS_FILE, "player/allow-pause-map", 0, gPauseMap);
GetSettingInt(SETTINGS_FILE, "player/interior-entry", 0, gInteriorEntry);
GetSettingInt(SETTINGS_FILE, "player/vehicle-surfing", 0, gVehicleSurfing);
GetSettingFloat(SETTINGS_FILE, "player/nametag-distance", 3.0, gNameTagDistance);
GetSettingInt(SETTINGS_FILE, "player/combat-log-window", 30, gCombatLogWindow);
GetSettingInt(SETTINGS_FILE, "player/login-freeze-time", 8, gLoginFreezeTime);
GetSettingInt(SETTINGS_FILE, "player/max-tab-out-time", 60, gMaxTaboutTime);
GetSettingInt(SETTINGS_FILE, "player/ping-limit", 400, gPingLimit);
// I'd appreciate if you left my credit and the proper gamemode name intact!
// Failure to do this will result in being blacklisted from the server list.
// And I'll be less inclined to help you with issues.
// Unless you have a decent reason to change the gamemode name (heavy mod)
// I'd still like to be credited for my work. Many servers have claimed
// they are the sole creator of the mode and this makes me sad and very
// hesitant to release my work completely free of charge.
SetGameModeText("Scavenge Survive by Southclaw");
Store = RequestsClient(storeEndpoint, RequestHeaders("Authorization", storeKey));
StorePingRequest = RequestJSON(
Store,
"/",
HTTP_METHOD_GET,
"OnStoreInit"
);
// SETTINGS
// if(!gPauseMap) {
// MiniMapOverlay = GangZoneCreate(-6000, -6000, 6000, 6000);
// }
if(!gInteriorEntry) {
DisableInteriorEnterExits();
}
SetNameTagDrawDistance(gNameTagDistance);
EnableStuntBonusForAll(false);
ManualVehicleEngineAndLights();
AllowInteriorWeapons(true);
// todo: GetMapName impl
// SendRconCommand(sprintf("mapname %s", GetMapName()));
RestartCount =TextDrawCreate(430.000000, 10.000000, "Server Restart In:~n~00:00");
TextDrawAlignment (RestartCount, 2);
TextDrawBackgroundColor (RestartCount, 255);
TextDrawFont (RestartCount, 1);
TextDrawLetterSize (RestartCount, 0.400000, 2.000000);
TextDrawColor (RestartCount, -1);
TextDrawSetOutline (RestartCount, 1);
TextDrawSetProportional (RestartCount, 1);
}
public OnRequestFailure(Request:id, errorCode, errorMessage[], len) {
if(id == StorePingRequest) {
fatal("store endpoint indexing failed",
_i("errorCode", errorCode),
_s("errorMessage", errorMessage));
return;
}
return;
}
forward OnStoreInit(Request:id, E_HTTP_STATUS:status, Node:node);
public OnStoreInit(Request:id, E_HTTP_STATUS:status, Node:node) {
if(status != HTTP_STATUS_OK) {
fatal("failed to connect to store",
_i("status", _:status));
}
new
bool:success,
message[128];
JsonGetBool(node, "success", success);
JsonGetString(node, "message", message);
if(!success) {
fatal("store response was not successful",
_s("message", message));
}
log("store endpoint confirmed", _s("message", message));
return;
}
public OnGameModeExit() {
if(gCrashOnExit) {
fatal("gamemode exiting with forced crash");
} else {
log("gamemode exiting");
}
return 1;
}
public OnScriptExit() {
log("script exiting");
return 0;
}
forward SetRestart(seconds);
public SetRestart(seconds) {
log("server restart triggered",
_i("seconds", seconds));
gServerUptime = gServerMaxUptime - seconds;
}
RestartGamemode() {
log("gamemode restarting");
gServerRestarting = true;
// foreach(new i : Player) {
// SavePlayerData(i);
// ResetVariables(i);
// }
SendRconCommand("gmx");
ChatMsgAll(Y_BLUE, " ");
ChatMsgAll(Y_ORANGE, "Scavenge and Survive");
ChatMsgAll(Y_BLUE, " Copyright (C) 2016 Barnaby \"Southclaws\" Keene");
ChatMsgAll(Y_BLUE, " This program comes with ABSOLUTELY NO WARRANTY; This is free software,");
ChatMsgAll(Y_BLUE, " and you are welcome to redistribute it under certain conditions.");
ChatMsgAll(Y_BLUE, " Please see <http://www.gnu.org/copyleft/gpl.html> for details.");
ChatMsgAll(Y_BLUE, " ");
ChatMsgAll(Y_BLUE, " ");
ChatMsgAll(Y_BLUE, "-------------------------------------------------------------------------------------------------------------------------");
ChatMsgAll(Y_YELLOW, " > The Server Is Restarting, Please Wait...");
ChatMsgAll(Y_BLUE, "-------------------------------------------------------------------------------------------------------------------------");
}
task RestartUpdate[1000]() {
if(gServerMaxUptime > 0) {
if(gServerUptime >= gServerMaxUptime) {
RestartGamemode();
}
if(gServerUptime >= gServerMaxUptime - 3600) {
new str[36];
format(str, 36, "Server Restarting In:~n~%02d:%02d", (gServerMaxUptime - gServerUptime) / 60, (gServerMaxUptime - gServerUptime) % 60);
TextDrawSetString(RestartCount, str);
foreach(new i : Player) {
TextDrawShowForPlayer(i, RestartCount);
// if(IsPlayerHudOn(i)) {
// } else {
// TextDrawHideForPlayer(i, RestartCount);
// }
}
}
gServerUptime++;
}
}
CreateDirIfNotExists(directory[]) {
if(!Exists(directory)) {
log("creating default directory",
_s("path", directory));
CreateDir(directory);
}
}
public Streamer_OnPluginError(const error[]) {
new tmp[256];
strcat(tmp, error, 256);
err(tmp);
}