· 8 years ago · Jan 03, 2018, 01:12 AM
1/*******************************************************************************
2********************************************************************************
3***** *****
4***** Jake's Admin System 4.0 *****
5***** *Last Patched: 01/01/2018 *****
6***** A new chapter begins. *****
7***** Originally coded on 2013. *****
8***** *****
9********************************************************************************
10********************************************************************************
11--------------------------------------------------------------------------------
12
13Changelog for JakAdmin 4.0:
14 * Script Optimization.
15 * Updated jadmin.inc (renamed from jadmin3)
16 * Ban System tweaked:
17 * Offline Banning now bans the IP.
18 * Added a Temporary Ban System (no effects on prev-ban database)
19 * Added a command to check if a player is banned. (/checkban)
20 * Added a command to ban/unban an IP. (/(un)banip)
21 * Security Checks on User Account.
22 * Prints out a log at the server console whenever a player fails to login/answer the security question.
23 * Lists last 10 IPs who tries to breach into the user's account. (/checkbreach)
24 * Level 5 admins:
25 * Ability to create a user account without logging out. (/createaccount)
26 * Ability to remove a user account. (/removeaccount)
27 * Full control on offline user's account (/setaccount)
28 * Server will now automatically kick tabbed out/idle players (/jsettings to disable)
29 * Ability to list down tabbed players. (/tabbed)
30 * Ability to list down AFK players. (/afk)
31 * Updated jadmin, adding idle/tabbed checks (IsPlayerTabbed & IsPlayerIdle)
32 * Removal of the Note System.
33 * Removal of the Mega Jump System.
34 * Removal of a few commands that is prone to being abused.
35 * Added LastOn over the user's data.
36 * Added /laston command.
37 * Re-added back the Lock Chat system. (/lockchat)
38 * Higher Admins are now immune from being included on Over-All commands such as /setallskin etc.
39 * Added /rcons for Level 5+
40 * Re-added back /hideme.
41 * Added label for Admins.
42 * Added Join/Leave messages (/jsettings)
43 * /god is now a Level 1 admin command.
44 * Switched from dini to y_ini.
45 * Changed the color embedding theme from Orange to Green.
46 * You can now permanently mute players without setting a time.
47 * You can check the last 5 people who injured the player.
48 * Added the /richlist command.
49 * Brought back the private message system.
50 * Added an option to make /stats into dialog or server-client message. (See USE_DIALOG)
51 * Converted the whole dialog script to Emmet's easyDialog.
52 * Added the Also-Known-As system. (See USE_AKA)
53 * Tweaked the Anti-Spam (+ now includes Command Spams)
54 * Admin's Status is now displayed on /stats.
55 * Fixed Advanced/Reverse Spectating.
56 * Added a command to check an offline statistics (/ostats)
57 * Client-Messages & Color re-tweaked (+ including grammar fixes).
58 * You can now cage players as a punishment! (Level 2+ admins)
59 * Fixed on /register. (crashes the server if the oldname PVar is null)
60 * Enables to print out all the players typed command on the server console (See PRINT_CMD)
61 * You are now required to use commas when placing coordinates on /gotoco.
62 * Control over the RCON Panel (promoting/demoting someone without going IG, etc.)
63 * Removal of the High-Ping Warning, player gets instantly kicked now for having a high ping.
64 * Removal of the VIP system, making JakAdmin a standalone script once again.
65
66Note:
67 * Check loadb function and removed the ALTER code if you don't need it.
68 It adds the column CHOCOLATE in the database for those old JakAdmin users (remove it if you aren't an old jakadmin user)
69 It also adds the USESKIN and SKIN column in the table (so the old user of JakAdmin won't need to delete the database)
70
71 * JakAdmin3's folder on scriptfiles was renamed to JakAdmin (please be informed)
72
73Credits goes to:
74 * Jake Hero (Scripting JakAdmin)
75 • Zeex (zcmd)
76 • Y_Less (sscanf/YSI/whirlpool)
77 • Lordzy (Second RCON Login)
78 * Ultraz (Suggestions)
79 * denNorske (Providing a temporary server-host)
80 * Stinged (RCON Command technique)
81 * Emmet_ (easyDialog)
82 • SA-MP Team
83 • Others who helped me on beta testing.
84
85-------------------------------------------------------------------------------*/
86
87#include <a_samp>
88native WP_Hash(buffer[], len, const str[]); // whirlpool by Y_Less
89native IsValidVehicle(vehicleid);
90#include <zcmd>
91#include <sscanf2>
92#include <streamer>
93#include <YSI\y_ini>
94#include <YSI\y_iterate> // foreach
95#include <easyDialog> // Emmet_
96
97#pragma dynamic 21016348
98
99//============================================================================//
100// Macros
101
102#define function:%0(%1) forward %0(%1);\
103 public %0(%1)
104
105#define LevelCheck(%0,%1); \
106 if(User[(%0)][accountAdmin] < %1 && !IsPlayerAdmin((%0)))\
107 return format(st, 90, "* You must be level %d to use this command.", (%1)),\
108 SendClientMessage((%0), COLOR_RED, st);
109
110#define LoginCheck(%1) if(User[%1][accountLogged] == 0) return SendClientMessage(%1, COLOR_RED, "* You must be logged in to use this command.")
111
112#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
113
114#define RCON:%0(%1) forward rcon_%0(%1); public rcon_%0(%1)
115
116#define abs(%1) (((%1) < 0) ? (-(%1)) : ((%1)))
117
118////////////////////////////////////////////////////////////////////////////////
119// Colors
120
121#define white "{FFFFFF}"
122#define lightblue "{33CCFF}"
123#define grey "{AFAFAF}"
124#define orange "{FF8000}"
125#define black "{2C2727}"
126#define red "{FF0000}"
127#define yellow "{FFFF00}"
128#define green "{33CC33}"
129#define blue "{0080FF}"
130#define purple "{D526D9}"
131#define pink "{FF80FF}"
132#define brown "{A52A2A}"
133
134#define COLOR_RED 0xFF0000C8
135#define COLOR_YELLOW 0xFFFF00AA
136#define COLOR_GREEN 0x33CC33C8
137#define COLOR_ORANGE 0xFF8000C8
138#define COLOR_WHITE 0xFFFFFFFF
139#define COLOR_PURPLE 0xD526D9FF
140#define COLOR_LIGHTGREEN 0x00FF00FF
141#define COLOR_PINK 0xFF80FFFF
142#define COLOR_LIGHTBLUE 0x33CCFFAA
143#define COLOR_GREY 0xAFAFAFAA
144#define COLOR_BLUE 0x0080FFC8
145#define COLOR_BROWN 0xA52A2AAA
146#define COLOR_BLACK 0x2C2727AA
147#define COLOR_ADMIN 0x0BBD5FEFF
148
149// All of the saved datas (exceptions for server configuration, goes to juser.db)
150#define _DB_ "JakAdmin/juser.db"
151
152// All of the logs (if it is enabled) goes here.
153#define _LOG_ "JakAdmin/Logs/"
154
155// Range Ban list goes here.
156#define BANLIST "JakAdmin/cidr-banlist.txt"
157
158// Current Version of the Script
159#define VERSION "4.0"
160
161// Spectate Modes
162#define ADMIN_SPEC_TYPE_NONE 0
163#define ADMIN_SPEC_TYPE_PLAYER 1
164#define ADMIN_SPEC_TYPE_VEHICLE 2
165
166// Starting score for registered player.
167#define STARTING_SCORE 1
168// Starting cash for registered player.
169#define STARTING_CASH 10000
170// Max warnings for attempting to logged in RCON.
171#define MAX_RCON_WARNINGS 3
172// Time Limit before you can send another message
173#define SPAM_TIMELIMIT 2 // In seconds
174// Maximum Notes an admin can drop to a specific player.
175#define MAX_NOTES 3
176// Maximum Deployable Labels
177#define MAX_DEPLOYABLE_LABEL 30
178// Enables DIALOG in register/login/stats/everything, remove or comment otherwise to make it client-server message.
179#define USE_DIALOG
180// Enables the 2nd RCON protection, remove or comment otherwise to disable.
181#define USE_RCON_PROTECTION
182// Password for the 2nd RCON
183#define RCON_PASSWORD "changeme"
184// Enables the AKA system, remove or comment otherwise to disable.
185#define USE_AKA
186// Enables the command printing/logging on the server console, remove or comment to disable.
187#define PRINT_CMD
188
189// Maximum Reports
190#define MAX_REPORTS 100
191
192////////////////////////////////////////////////////////////////////////////////
193// Enums
194
195enum ReportInfo
196{
197 bool:reportTaken,
198 reporterID,
199 reportedID,
200 reportReason[64],
201 reportTime[32],
202 reportAccepted
203};
204
205enum ServerData
206{
207 TabTime,
208 AFKTime,
209 ReadPMs,
210 JoinMsg,
211 RegisterOption,
212 LoginWarn,
213 SecureWarn,
214 SaveLogs,
215 AutoLogin,
216 ReadCmds,
217 ReadCmd, // Type 0 - Default (OLD), 1 - Spectate Players
218 MaxPing,
219 AntiSwear,
220 AntiName,
221 AntiAd,
222 AntiSpam,
223 LockChat,
224 AdminRank1[32],
225 AdminRank2[32],
226 AdminRank3[32],
227 AdminRank4[32],
228 AdminRank5[32]
229};
230
231enum PlayerInfo
232{
233 accountID,
234 accountGod,
235 accountChocolate,
236 accountLastOn[32],
237 accountName[24],
238 accountIP[20],
239 accountQuestion[92],
240 accountAnswer[129],
241 accountPassword[129],
242 accountMarker,
243 accountUseSkin,
244 accountSkin,
245 accountAdmin,
246 accountAdminEx,
247 accountTemporary,
248 accountKills,
249 accountDeaths,
250 accountLogged,
251 WarnLog,
252 accountDate[64],
253 accountWarn,
254 accountMuted,
255 accountMuteSec,
256 accountCMuted,
257 accountCMuteSec,
258 accountJail,
259 accountJailSec,
260 accountTabbed,
261 accountAFK,
262 Float:accountAFKPos[3],
263 SpecID,
264 SpecType,
265 pCar,
266 accountCage,
267 accountCageObject,
268 accountGame[3],
269 accountGameEx,
270 accountDuty,
271 SpamTime,
272 accountPM,
273 accountHide,
274 Text3D:accountLabel
275};
276
277enum LabelInfo
278{
279 labelTaken,
280 Text3D:label3D,
281 Float:labelX,
282 Float:labelY,
283 Float:labelZ,
284 labelInterior,
285 labelVW
286};
287
288// Arrays
289
290new VehicleNames[212][] = {
291 {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
292 {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
293 {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
294 {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
295 {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
296 {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
297 {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
298 {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
299 {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
300 {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
301 {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
302 {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
303 {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
304 {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
305 {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
306 {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
307 {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
308 {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
309 {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
310 {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
311 {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
312 {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
313 {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
314 {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
315 {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
316 {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
317 {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
318 {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
319 {"Utility Trailer"}
320};
321
322new rInfo[MAX_PLAYERS][ReportInfo];
323new User[MAX_PLAYERS][PlayerInfo];
324new ServerInfo[ServerData];
325new lInfo[MAX_DEPLOYABLE_LABEL][LabelInfo];
326
327new
328 DamagedPlayer[MAX_PLAYERS][5][24],
329 DamagedStamp[MAX_PLAYERS][5], DamagedWeapon[MAX_PLAYERS][5], BadNames[100][100], BadNameCount = 0, ForbiddenWords[100][100], ForbiddenWordCount = 0,
330 VoteKickReason[64], VoteKickTarget = INVALID_PLAYER_ID, VoteKickHappening = 0, bool:HasAlreadyVoted[MAX_PLAYERS char], MaxVKICK = 2,
331 KickTime = 60, svotes = 0, avotes = 0, VoteTimer
332;
333
334// Variables
335
336new DB:Database, new_Warn[MAX_PLAYERS];
337
338#if defined USE_RCON_PROTECTION
339 // OPRL is included in the script if the RCON Protection is turned on.
340 #include <OPRL>
341 new bool:_RCON[MAX_PLAYERS];
342 new _RCONwarn[MAX_PLAYERS];
343#endif
344
345stock st[90];
346
347new SpecInt[MAX_PLAYERS][2], Float:SpecPos[MAX_PLAYERS][4];
348
349//============================================================================//
350
351public OnFilterScriptInit()
352{
353 new day, month, year, hour, sec, mins, result = GetTickCount();
354
355 getdate(year, month, day);
356 gettime(hour, mins, sec);
357
358 format(VoteKickReason, sizeof(VoteKickReason), "None");
359 VoteKickHappening = 0;
360 avotes = 0;
361 svotes = 0;
362 VoteKickTarget = INVALID_PLAYER_ID;
363 KillTimer(VoteTimer);
364
365 //////////////////////
366
367 foreach(new i : Player)
368 HasAlreadyVoted{i} = false;
369
370 for(new i; i < MAX_REPORTS; i++)
371 ResetReport(i);
372
373 // Checks the JakAdmin and logs folder if exist, otherwise sends a print message.
374 checkfolder();
375
376 print("\n");
377
378 // Loads juser.db
379 loadb();
380 Config();
381
382 // Ping Timer (if set to true)
383 SetTimer("PingCheck", 1000, true);
384 // Punishment Timer Handler
385 SetTimer("PunishmentHandle", 1000, true);
386 // GamePlay
387 SetTimer("GamePlay", 1000, true);
388
389 foreach(new i : Player)
390 OnPlayerConnect(i);
391
392 print("----------------------------------------------------------------");
393 printf("\nGamemode %s (January 2018 release)", VERSION);
394 printf("[Bs] Date: %02i/%02i/%02i | Time: %02d:%02d:%02d", day, month, year, hour, mins, sec);
395 printf("[Benchmark] Loaded in: %i ms", (GetTickCount() - result));
396 print("Filterscript Executed...\n");
397 print("----------------------------------------------------------------\n");
398 return 1;
399}
400
401public OnFilterScriptExit()
402{
403 new day, month, year, hour, sec, mins, result = GetTickCount();
404 getdate(year, month, day);
405 gettime(hour, mins, sec);
406
407 // Closing juser.db
408 closedb();
409
410 for(new c; c < MAX_REPORTS; c++)
411 {
412 ResetReport(c);
413 }
414
415 foreach(new i : Player)
416 {
417 if(IsValidVehicle(User[i][pCar]))
418 {
419 DestroyVehicle(User[i][pCar]);
420 }
421 OnPlayerDisconnect(i, 1);
422 User[i][accountLogged] = 0;
423 }
424
425 print("----------------------------------------------------------------");
426 printf("\nGamemode %s (January 2018 release)", VERSION);
427 printf("[Bs] Date: %02i/%02i/%02i | Time: %02d:%02d:%02d", day, month, year, hour, mins, sec);
428 printf("[Benchmark] Unloaded in: %i ms", (GetTickCount() - result));
429 print("Filterscript Unloaded...\n");
430 print("----------------------------------------------------------------\n");
431 return 1;
432}
433
434function:IsSeatAvailable(vehicleid, seat)
435{
436 new carmodel = GetVehicleModel(vehicleid);
437
438 new OneSeatVehicles[38] =
439 {
440 425, 430, 432, 441, 446, 448, 452, 453,
441 454, 464, 465, 472, 473, 476, 481, 484,
442 485, 486, 493, 501, 509, 510, 519, 520,
443 530, 531, 532, 539, 553, 564, 568, 571,
444 572, 574, 583, 592, 594, 595
445 };
446
447 for(new i = 0; i < sizeof(OneSeatVehicles); i++)
448 {
449 if(carmodel == OneSeatVehicles[i])
450 return 0;
451 }
452
453 foreach(new i : Player)
454 {
455 if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seat)
456 return 0;
457 }
458 return 1;
459}
460
461function:EndVoteKick(playerid)
462{
463 new
464 string[128]
465 ;
466
467 if(svotes > avotes)
468 {
469 format(string, sizeof(string), "* The time has run out! Votes for yes: %i | Votes for no: %i", svotes, avotes);
470 SendClientMessageToAll(COLOR_ORANGE, string);
471 format(string, sizeof(string), "* %s is kicked for %s.", pName(VoteKickTarget), VoteKickReason);
472 SendClientMessageToAll(COLOR_RED, string);
473 KickDelay(VoteKickTarget);
474 }
475 else
476 {
477 format(string, sizeof(string), "* The time has run out! Votes for yes: %i | Votes for no: %i", svotes, avotes);
478 SendClientMessageToAll(COLOR_ORANGE, string);
479 format(string, sizeof(string), "* Failed to get %s kicked, They stay in the server.", pName(VoteKickTarget));
480 SendClientMessageToAll(COLOR_RED, string);
481 }
482
483 if(svotes == 0 && avotes == 0)
484 {
485 SendClientMessageToAll(COLOR_RED, "* The time has run out, and nobody has voted!");
486 format(string, sizeof(string), "* Failed to get %s kicked, They stay in the server.", pName(VoteKickTarget));
487 SendClientMessageToAll(COLOR_RED, string);
488 }
489
490 format(VoteKickReason, sizeof(VoteKickReason), "None");
491 VoteKickHappening = 0;
492 avotes = 0;
493 svotes = 0;
494 VoteKickTarget = INVALID_PLAYER_ID;
495 KillTimer(VoteTimer);
496 //////////////////////
497 foreach(new i : Player)
498 {
499 HasAlreadyVoted{i} = false;
500 }
501 return 1;
502}
503
504function:PunishmentHandle()
505{
506 new string[128];
507
508 foreach(new i : Player)
509 {
510 if(User[i][accountJail])
511 {
512 if(User[i][accountJailSec] >= 1)
513 {
514 User[i][accountJailSec] --;
515 }
516 else if(User[i][accountJailSec] == 0)
517 {
518 User[i][accountJail] = 0;
519 format(string, sizeof(string), "** %s has served their admin-jail time.", pName(i));
520 SendClientMessageToAll(COLOR_ADMIN, string);
521 SpawnPlayer(i);
522 }
523 }
524 if(User[i][accountMuted])
525 {
526 if(User[i][accountMuteSec] >= 1)
527 {
528 User[i][accountMuteSec] --;
529 }
530 else if(User[i][accountMuteSec] == 0)
531 {
532 User[i][accountMuted] = 0;
533 format(string, sizeof(string), "** %s has served their mute punishment.", pName(i));
534 SendClientMessageToAll(COLOR_ADMIN, string);
535 }
536 }
537 if(User[i][accountCMuted])
538 {
539 if(User[i][accountCMuteSec] >= 1)
540 {
541 User[i][accountCMuteSec] --;
542 }
543 else if(User[i][accountCMuteSec] == 0)
544 {
545 User[i][accountCMuted] = 0;
546 format(string, sizeof(string), "** %s has served their command-mute punishment.", pName(i));
547 SendClientMessageToAll(COLOR_ADMIN, string);
548 }
549 }
550 }
551 return 1;
552}
553
554function:PingCheck()
555{
556 new string[128];
557
558 foreach(new i : Player)
559 {
560 GetPlayerPos(i, User[i][accountAFKPos][0], User[i][accountAFKPos][1], User[i][accountAFKPos][2]);
561
562 if(GetPlayerState(i) >= 1 && GetPlayerState(i) <= 3)
563 {
564 if(IsPlayerInRangeOfPoint(i, 2.0, User[i][accountAFKPos][0], User[i][accountAFKPos][1], User[i][accountAFKPos][2]))
565 {
566 if(++User[i][accountAFK] >= ServerInfo[AFKTime] && ServerInfo[AFKTime])
567 {
568 format(string, sizeof(string), "** %s was kicked from the server. (Reason: Idle for %d seconds)", pName(i), User[i][accountAFK]);
569 SendClientMessageToAll(COLOR_ADMIN, string);
570 format(string, sizeof(string), "* You have been kicked from the server. (Idle for %d seconds)", User[i][accountAFK]);
571 SendClientMessage(i, -1, string);
572 return KickDelay(i);
573 }
574 }
575
576 User[i][accountTabbed] ++;
577 if(ServerInfo[TabTime] && User[i][accountTabbed] >= ServerInfo[TabTime])
578 {
579 format(string, sizeof(string), "** %s was kicked from the server. (Reason: Alt-Tabbed for %d seconds)", pName(i), User[i][accountTabbed]);
580 SendClientMessageToAll(COLOR_ADMIN, string);
581 format(string, sizeof(string), "* You have been kicked from the server. (Alt-Tabbing for %d seconds)", User[i][accountTabbed]);
582 SendClientMessage(i, -1, string);
583 return KickDelay(i);
584 }
585 }
586
587 if(User[i][accountGod])
588 {
589 SetPlayerHealth(i, 100000);
590 }
591
592 if(GetPlayerPing(i) > ServerInfo[MaxPing] && ServerInfo[MaxPing])
593 {
594 format(string, sizeof(string), "** %s was kicked from the server (Reason: High Ping [%d/%d])", pName(i), GetPlayerPing(i), ServerInfo[MaxPing]);
595 SendClientMessageToAll(COLOR_ADMIN, string);
596 return KickDelay(i);
597 }
598 }
599 return 1;
600}
601
602function:GamePlay()
603{
604 foreach(new playerid : Player)
605 {
606 if(User[playerid][accountLogged] == 1)
607 {
608 User[playerid][accountGame][0] += 1;
609 if(User[playerid][accountGame][0] == 60)
610 {
611 User[playerid][accountGame][0] = 0;
612 User[playerid][accountGame][1] += 1;
613 if(User[playerid][accountGame][1] >= 59 && User[playerid][accountGame][0] == 0)
614 {
615 User[playerid][accountGame][1] = 0;
616 User[playerid][accountGame][2] += 1;
617 }
618 }
619 }
620 }
621 return 1;
622}
623
624public OnPlayerConnect(playerid)
625{
626 new temp_ban, bQuery[128], reason[128], admin[24], when[32], DBResult:jResult, Query[128], DBResult: Result, fIP[20];
627 static string[128];
628 string[0] = 0;
629
630 if(ServerInfo[AntiName])
631 {
632 for(new s = 0; s < BadNameCount; s++)
633 {
634 if(!strcmp(BadNames[s], pName(playerid), true))
635 {
636 format(string, sizeof string, "** %s was kicked from the server. (Forbidden Name)", pName(playerid));
637 SendClientMessageToAll(COLOR_RED, string);
638 print(string);
639 SaveLog("kicklog.txt", string);
640 return KickDelay(playerid);
641 }
642 }
643 }
644
645 for(new x; x < _: PlayerInfo; ++x ) User[playerid][PlayerInfo: x] = 0;
646 User[playerid][SpecID] = INVALID_PLAYER_ID;
647 User[playerid][accountSkin] = -1;
648
649 for(new i; i < 5; i++)
650 {
651 DamagedStamp[playerid][i] = 0;
652 format(DamagedPlayer[playerid][i], 24, "");
653 }
654
655 #if defined USE_RCON_PROTECTION
656 _RCON[playerid] = false;
657 _RCONwarn[playerid] = 0;
658 #endif
659
660 User[playerid][accountMarker] = false;
661 User[playerid][accountDuty] = 0;
662 User[playerid][SpamTime] = 0;
663 User[playerid][accountTemporary] = false;
664 User[playerid][accountAdminEx] = 0;
665 User[playerid][accountGameEx] = gettime();
666 User[playerid][accountPM] = 1;
667 DestroyDynamic3DTextLabel(User[playerid][accountLabel]);
668
669 User[playerid][accountGod] = 0;
670
671 GetPlayerName(playerid, User[playerid][accountName], MAX_PLAYER_NAME);
672 GetPlayerIp(playerid, User[playerid][accountIP], 20);
673
674 new_Warn[playerid] = 0;
675
676 LoadAKA(playerid);
677 ////////////////////////////////////////////////////////////////////////////
678 new ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second;
679 getdate(ip_year, ip_month, ip_day);
680 gettime(ip_hour, ip_minute, ip_second);
681 format(bQuery, sizeof(bQuery), "SELECT * FROM `ips` WHERE `username` = '%s' AND `ip` = '%s'", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]));
682 jResult = db_query(Database, bQuery);
683 if(!db_num_rows(jResult))
684 {
685 format(bQuery, sizeof(bQuery), "INSERT INTO `ips` (`username`, `ip`, `date`, `time`) VALUES('%s', '%s', '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
686 db_query(Database, bQuery);
687 }
688 else
689 {
690 format(bQuery, sizeof(bQuery), "DELETE FROM `ips` WHERE `ip` = '%s'", DB_Escape(User[playerid][accountIP]));
691 db_query(Database, bQuery);
692 format(bQuery, sizeof(bQuery), "INSERT INTO `ips` (`username`, `ip`, `date`, `time`) VALUES('%s', '%s', '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
693 db_query(Database, bQuery);
694 }
695 ////////////////////////////////////////////////////////////////////////////
696 format(bQuery, sizeof(bQuery), "SELECT * FROM `bans` WHERE `username` = '%s'", DB_Escape(pName(playerid)));
697 jResult = db_query(Database, bQuery);
698
699 if(db_num_rows(jResult) && CheckBan(User[playerid][accountIP]))
700 {
701 SetPVarInt(playerid, "ban_id", db_get_field_assoc_int(jResult, "banid"));
702 db_get_field_assoc(jResult, "banby", admin, sizeof(admin));
703 db_get_field_assoc(jResult, "banreason", reason, 128);
704 db_get_field_assoc(jResult, "banwhen", when, sizeof(when));
705 temp_ban = db_get_field_assoc_int(jResult, "temporary_ban");
706
707 if(gettime() > temp_ban && temp_ban != 340703845)
708 {
709 UnbanAccountEx(playerid);
710 }
711 else
712 {
713 for(new i; i < 100; i++)
714 {
715 SendClientMessage(playerid, -1, " ");
716 }
717 ShowBan(playerid, GetPVarInt(playerid, "ban_id"), admin, reason, when, temp_ban);
718 KickDelay(playerid);
719 }
720 return db_free_result(jResult), 1;
721 }
722 else if(db_num_rows(jResult) && !CheckBan(User[playerid][accountIP]))
723 {
724 SetPVarInt(playerid, "ban_id", db_get_field_assoc_int(jResult, "banid"));
725 db_get_field_assoc(jResult, "banby", admin, sizeof(admin));
726 db_get_field_assoc(jResult, "banreason", reason, 128);
727 db_get_field_assoc(jResult, "banwhen", when, sizeof(when));
728 temp_ban = db_get_field_assoc_int(jResult, "temporary_ban");
729
730 if(gettime() > temp_ban && temp_ban != 340703845)
731 {
732 UnbanAccountEx(playerid);
733 }
734 else
735 {
736 for(new i; i < 100; i++)
737 {
738 SendClientMessage(playerid, -1, " ");
739 }
740 ShowBan(playerid, GetPVarInt(playerid, "ban_id"), admin, reason, when, temp_ban);
741 KickDelay(playerid);
742 }
743 return db_free_result(jResult), 1;
744 }
745 else if(!db_num_rows(jResult) && CheckBan(User[playerid][accountIP]))
746 {
747 for(new i; i < 100; i++)
748 {
749 SendClientMessage(playerid, -1, " ");
750 }
751 SendClientMessage(playerid, COLOR_RED, "* Your IP address is banned from the server.");
752 BanAccount(playerid, "JakAdmin", "IP Banned");
753
754 KickDelay(playerid);
755 return db_free_result(jResult), 1;
756 }
757 if(ServerInfo[JoinMsg])
758 {
759 format(string, sizeof(string), "[Join] %s (ID: %d) has joined the server.", pName(playerid), playerid);
760 SendClientMessageToAll(COLOR_GREY, string);
761 }
762 ////////////////////////////////////////////////////////////////////////////
763 if(ServerInfo[AutoLogin])
764 {
765 format(Query, sizeof(Query), "SELECT `password`, `question`, `answer`, `IP` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
766 Result = db_query(Database, Query);
767 }
768 else
769 {
770 format(Query, sizeof(Query), "SELECT `password`, `question`, `answer` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
771 Result = db_query(Database, Query);
772 }
773 ////////////////////////////////////////////////////////////////////////////
774 if(db_num_rows(Result))
775 {
776 db_get_field_assoc(Result, "password", User[playerid][accountPassword], 129);
777 db_get_field_assoc(Result, "question", User[playerid][accountQuestion], 92);
778 db_get_field_assoc(Result, "answer", User[playerid][accountAnswer], 129);
779
780 if(ServerInfo[AutoLogin])
781 {
782 db_get_field_assoc(Result, "IP", fIP, 20);
783 if(strcmp(fIP, User[playerid][accountIP], true) == 0)
784 {
785 SendClientMessage(playerid, -1, "You have been auto logged in.");
786 LoginPlayer(playerid);
787 }
788 else
789 {
790 #if defined USE_DIALOG
791 if(!strcmp(User[playerid][accountQuestion], "none", true))
792 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.", "Login", "Quit");
793 else
794 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.\n\nPress Forget button if you have forgotten your account's password", "Login", "Forget");
795 #else
796 SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
797 #endif
798 }
799 }
800 else
801 {
802 #if defined USE_DIALOG
803 if(!strcmp(User[playerid][accountQuestion], "none", true))
804 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.", "Login", "Quit");
805 else
806 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.\n\nPress Forget button if you have forgotten your account's password", "Login", "Forget");
807 #else
808 SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
809 #endif
810 }
811 }
812 else
813 {
814 #if defined USE_DIALOG
815 if(ServerInfo[RegisterOption])
816 Dialog_Show(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""green"Register", "Welcome to the Server!\nYour account doesn't exist in our database, Please insert your password below.\n\n"red"* You can skip the server account registration by pressing SKIP.", "Register", "Skip");
817 else
818 Dialog_Show(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""green"Register", "Welcome to the Server!\nYour account doesn't exist in our database, Please insert your password below.", "Register", "Quit");
819 #else
820 if(ServerInfo[RegisterOption])
821 SendClientMessage(playerid, COLOR_RED, "* You may skip the server account-registration.");
822 SendClientMessage(playerid, COLOR_ORANGE, "REGISTER: /register [password] to register your account.");
823 else
824 SendClientMessage(playerid, COLOR_ORANGE, "REGISTER: /register [password] to register your account.");
825 #endif
826 }
827 db_free_result(Result);
828 ////////////////////////////////////////////////////////////////////////////
829 return 1;
830}
831
832public OnPlayerDisconnect(playerid, reason)
833{
834 new string[128], reasonstr[24];
835
836 if(User[playerid][accountCage])
837 DestroyPlayerObject(playerid, User[playerid][accountCageObject]);
838
839 if(User[playerid][accountTemporary])
840 {
841 User[playerid][accountAdmin] = User[playerid][accountAdminEx];
842 User[playerid][accountAdminEx] = 0;
843 User[playerid][accountTemporary] = false;
844 }
845
846 for(new c; c < MAX_REPORTS; c++)
847 {
848 if(rInfo[c][reportTaken])
849 {
850 if(rInfo[c][reporterID] == playerid || rInfo[c][reportedID] == playerid)
851 {
852 ResetReport(c);
853 }
854 }
855 }
856
857 for(new x=0; x<MAX_PLAYERS; x++)
858 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
859 AdvanceSpectate(x);
860
861 if(ServerInfo[JoinMsg])
862 {
863 switch(reason)
864 {
865 case 0: reasonstr = "Crashed";
866 case 1: reasonstr = "Left";
867 case 2: reasonstr = "Kicked/Banned";
868 }
869 format(string, sizeof(string), "[%s] %s (ID: %d) quit the server.", reasonstr, pName(playerid), playerid);
870 SendClientMessageToAll(COLOR_GREY, string);
871 }
872
873 if(IsValidVehicle(User[playerid][pCar]))
874 EraseVeh(User[playerid][pCar]);
875
876 //Saves the statistics to the .db.
877 SaveData(playerid);
878
879 if(VoteKickHappening && VoteKickTarget == playerid)
880 {
881 format(string, sizeof(string), "** %s has left the server while they are being voted for a kick.", pName(playerid));
882 SendClientMessageToAll(COLOR_ADMIN, string);
883 //////////////////////
884 format(VoteKickReason, sizeof(VoteKickReason), "None");
885 VoteKickHappening = 0;
886 avotes = 0;
887 svotes = 0;
888 VoteKickTarget = INVALID_PLAYER_ID;
889 KillTimer(VoteTimer);
890 //////////////////////
891 foreach(new i : Player)
892 {
893 HasAlreadyVoted{i} = false;
894 }
895 }
896
897 User[playerid][accountGameEx] = 0;
898 return 1;
899}
900
901public OnPlayerUpdate(playerid)
902{
903 if(User[playerid][accountTabbed] >= 1)
904 {
905 User[playerid][accountTabbed] = 0;
906 }
907
908 User[playerid][accountAFK] = 0;
909 return 1;
910}
911
912public OnPlayerSpawn(playerid)
913{
914 // Label Deploy
915 if(User[playerid][accountAdmin] > 0)
916 User[playerid][accountLabel] = CreateDynamic3DTextLabel(GetAdminRank(User[playerid][accountAdmin]), 0xFF0000FF, 0, 0, 0.30, 25, playerid, .testlos = 1);
917 // Cage Check
918 if(User[playerid][accountCage])
919 {
920 CageNikka(playerid);
921 SendClientMessage(playerid, COLOR_ADMIN, "* Cage deployed, You are previously placed in a cage by an admin.");
922 }
923 // Jail Check
924 if(User[playerid][accountJail])
925 {
926 SetTimerEx("JailPlayer", 2000, 0, "d", playerid);
927 SendClientMessage(playerid, COLOR_RED, "* You are previously jailed by an admin, You'll serve your sentence.");
928 SendClientMessage(playerid, COLOR_ADMIN, "Placing back in the cell...");
929 }
930 // Saved Skin
931 if(User[playerid][accountUseSkin] && User[playerid][accountAdmin])
932 SetPlayerSkin(playerid, User[playerid][accountSkin]);
933 return 1;
934}
935
936function:JailPlayer(playerid)
937{
938 static string[92];
939 string[0] = 0;
940
941 SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
942 SetPlayerInterior(playerid, 3);
943 SetCameraBehindPlayer(playerid);
944
945 format(string, sizeof(string), "You have been placed in jail for %d seconds.", User[playerid][accountJailSec]);
946 SendClientMessage(playerid, COLOR_RED, string);
947 return 1;
948}
949
950public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
951{
952 if(issuerid != INVALID_PLAYER_ID)
953 {
954 DamagedWeapon[playerid][4] = DamagedWeapon[playerid][3];
955 DamagedWeapon[playerid][3] = DamagedWeapon[playerid][2];
956 DamagedWeapon[playerid][2] = DamagedWeapon[playerid][1];
957 DamagedWeapon[playerid][1] = DamagedWeapon[playerid][0];
958 DamagedWeapon[playerid][0] = weaponid;
959
960 DamagedStamp[playerid][4] = DamagedStamp[playerid][3];
961 DamagedStamp[playerid][3] = DamagedStamp[playerid][2];
962 DamagedStamp[playerid][2] = DamagedStamp[playerid][1];
963 DamagedStamp[playerid][1] = DamagedStamp[playerid][0];
964 DamagedStamp[playerid][0] = gettime();
965
966 format(DamagedPlayer[playerid][4], 24, DamagedPlayer[playerid][3]);
967 format(DamagedPlayer[playerid][3], 24, DamagedPlayer[playerid][2]);
968 format(DamagedPlayer[playerid][2], 24, DamagedPlayer[playerid][1]);
969 format(DamagedPlayer[playerid][1], 24, DamagedPlayer[playerid][0]);
970 format(DamagedPlayer[playerid][0], 24, pName(issuerid));
971 }
972 return 1;
973}
974
975public OnPlayerDeath(playerid, killerid, reason)
976{
977 for(new x=0; x<MAX_PLAYERS; x++)
978 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
979 AdvanceSpectate(x);
980
981 User[playerid][accountDeaths] ++;
982 if(killerid != INVALID_PLAYER_ID)
983 {
984 User[killerid][accountKills] ++;
985 }
986 return 1;
987}
988
989public OnVehicleSpawn(vehicleid)
990{
991 foreach(new i : Player)
992 {
993 if(vehicleid == User[i][pCar])
994 {
995 EraseVeh(vehicleid);
996 }
997 }
998 return 1;
999}
1000
1001public OnPlayerText(playerid, text[])
1002{
1003 new string[128];
1004
1005 User[playerid][accountAFK] = 0;
1006
1007 if(ServerInfo[LockChat] && User[playerid][accountAdmin] < 1)
1008 return SendClientMessage(playerid, COLOR_RED, "* Chat has been disabled by an admin."), 0;
1009
1010 if(ServerInfo[AntiAd] && User[playerid][accountAdmin] < 3)
1011 {
1012 if(IsAdvertisement(text))
1013 {
1014 format(string, sizeof(string), "Warning: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, text);
1015 SendAdmin(COLOR_RED, string);
1016 return 0;
1017 }
1018 }
1019
1020 if(User[playerid][accountMuted])
1021 {
1022 if(User[playerid][accountMuteSec] > 0)
1023 {
1024 format(string, sizeof(string), "You are muted, You can talk in %d seconds.", User[playerid][accountMuteSec]);
1025 SendClientMessage(playerid, COLOR_ORANGE, string);
1026 }
1027 else if(User[playerid][accountMuteSec] == -1) SendClientMessage(playerid, COLOR_ORANGE, "You are permanently muted from talking.");
1028 return 0;
1029 }
1030
1031 if(ServerInfo[AntiSpam])
1032 {
1033 if((!User[playerid][accountAdmin] && !IsPlayerAdmin(playerid)))
1034 {
1035 if((GetTickCount() - User[playerid][SpamTime]) < (1000*SPAM_TIMELIMIT))
1036 {
1037 format(string, sizeof(string), "* You have to wait for %d seconds before you can send another chat/command.", SPAM_TIMELIMIT);
1038 SendClientMessage(playerid, COLOR_RED, string);
1039 return 0;
1040 }
1041 }
1042 User[playerid][SpamTime] = GetTickCount();
1043 }
1044
1045 if(text[0] == '#' && User[playerid][accountAdmin] >= 1)
1046 {
1047 format(string, sizeof( string ), "[AdminChat]"white" %s %s: %s", GetAdminRank(User[playerid][accountAdmin]), pName(playerid), text[1]);
1048 SendAdmin(0x9ACD32AA, string);
1049 printf("[AdminChat] %s %s: %s", GetAdminRank(User[playerid][accountAdmin]), pName(playerid), text[1]);
1050
1051 SaveLog("adminchat.txt", string);
1052 return 0;
1053 }
1054 if(text[0] == '@' && User[playerid][accountAdmin] >= 4)
1055 {
1056 format(string, sizeof( string ), "[LAChat]"white" %s %s: %s", GetAdminRank(User[playerid][accountAdmin]), pName(playerid), text[1]);
1057 foreach(new i : Player) if(User[i][accountAdmin] >= 4)
1058 {
1059 SendClientMessage(i, 0xFFD700FF, string);
1060 }
1061 printf("[LAChat] %s %s: %s", GetAdminRank(User[playerid][accountAdmin]), pName(playerid), text[1]);
1062 SaveLog("hachat.txt", string);
1063 return 0;
1064 }
1065
1066 if(ServerInfo[AntiSwear])
1067 {
1068 for(new s = 0; s < ForbiddenWordCount; s++)
1069 {
1070 new pos;
1071 while((pos = strfind(text,ForbiddenWords[s],true)) != -1) for(new i = pos, j = pos + strlen(ForbiddenWords[s]); i < j; i++) text[i] = '*';
1072 }
1073 }
1074 return 1;
1075}
1076
1077public OnRconCommand(cmd[])
1078{
1079 // Credits to Stinged
1080 new command[32], pos;
1081 while (cmd[pos] > ' ')
1082 {
1083 command[pos] = cmd[pos];
1084 pos++;
1085 }
1086 format(command, sizeof (command), "rcon_%s", command);
1087 while (cmd[pos] == ' ')
1088 pos++;
1089
1090 if (!cmd[pos]) return CallLocalFunction(command, "s", "\1");
1091 return CallLocalFunction(command, "s", cmd[pos]);
1092}
1093
1094//============================================================================//
1095// RCON Commands
1096
1097RCON:jjjcmds(params[])
1098{
1099 print("\nJakAdmin RCON Panel Commands:");
1100 print("USAGE in game: /rcon [cmds] [parameters]");
1101 print("USAGE in panel: [cmds] [parameters]");
1102 print("* a (admin chat) la (head admin chat) jconfig");
1103 print("* message (msg) set(temp)level aka removeacc fakecmd reloadcfg\n");
1104 return 1;
1105}
1106
1107RCON:jjjconfig(params[])
1108{
1109 Config();
1110 return 1;
1111}
1112
1113RCON:reloadcfg(params[])
1114{
1115 SendAdmin(COLOR_YELLOW, "[CFG] Someone from the panel has reload the cfgs files for JakAdmin.");
1116 checkfolder();
1117 print("[CFG] Someone from the panel has reload the cgs files for JakAdmin.");
1118 return 1;
1119}
1120
1121RCON:message(params[])
1122{
1123 new string[128],id, text[128];
1124
1125 if(sscanf(params, "us[128]", id, text))
1126 return print("USAGE: /rcon message [playerid] [text]"), 1;
1127
1128 if(id == INVALID_PLAYER_ID)
1129 return print("ERROR: Player not connected."), 1;
1130
1131 format(string, sizeof(string), "* Message from RCON: %s", text);
1132 SendClientMessage(id, COLOR_LIGHTBLUE, string);
1133 printf("* Message sent to %s: %s", pName(id), text);
1134 return 1;
1135}
1136
1137RCON:msg(params[]) return rcon_message(params);
1138
1139RCON:fakecmd(params[])
1140{
1141 new id, cmdtext[128];
1142
1143 if(sscanf(params, "us[128]", id, cmdtext))
1144 return print("USAGE: /rcon fakecmd [playerid] [command]"), 1;
1145
1146 if(id == INVALID_PLAYER_ID)
1147 return print("ERROR: Player not connected."), 1;
1148
1149 if(strfind(params, "/", false) != -1)
1150 {
1151 CallRemoteFunction("OnPlayerCommandText", "is", id, cmdtext);
1152 printf("Fake command sent to %s with %s", pName(id), cmdtext);
1153 }
1154 else print("ERROR: Add '/' before putting the command name to avoid the command unknown error.");
1155 return 1;
1156}
1157
1158RCON:a(params[])
1159{
1160 new string[128];
1161
1162 if(isnull(params))
1163 return print("USAGE: /rcon a [text]"), 1;
1164
1165 format(string, sizeof(string), "[AdminChat]"white" RCON: %s", params);
1166 SendAdmin(COLOR_YELLOW, string);
1167 printf("[AdminChat] RCON: %s", params);
1168 SaveLog("adminchat.txt", string);
1169 return 1;
1170}
1171
1172RCON:la(params[])
1173{
1174 new string[128];
1175
1176 if(isnull(params))
1177 return print("USAGE: /rcon la [text]"), 1;
1178
1179 format(string, sizeof(string), "[LAChat]"white" RCON: %s", params);
1180 foreach(new i : Player) if(User[i][accountAdmin] >= 4)
1181 {
1182 SendClientMessage(i, 0xFFD700FF, string);
1183 }
1184
1185 printf("[LAChat] RCON: %s", params);
1186 SaveLog("hachat.txt", string);
1187 return 1;
1188}
1189
1190RCON:removeaccount(params[])
1191{
1192 new name[24], DBResult:result, query[128];
1193
1194 if(sscanf(params, "s[24]", name))
1195 return print("USAGE: /rcon removeaccount [name]"), 1;
1196
1197 new id = ReturnUser(name);
1198
1199 if(IsPlayerConnected(id))
1200 return printf("ERROR: '%s' is in game. (PlayerID: %d)", id), 1;
1201
1202 format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
1203 result = db_query(Database, query);
1204
1205 if(db_num_rows(result))
1206 {
1207 format(query, sizeof(query), "DELETE FROM `users` WHERE `username` = '%s'", DB_Escape(name));
1208 db_query(Database, query);
1209
1210 printf("[Removed] You have removed the account: '%s'", name);
1211 printf("[ACCOUNT] Someone from the panel has removed '%s's account' (/removeaccount)", name);
1212 }
1213 else
1214 {
1215 printf("ERROR: '%s' doesn't exist.", name);
1216 }
1217 db_free_result(result);
1218 return 1;
1219}
1220
1221#if defined USE_AKA
1222RCON:aka(params[])
1223{
1224 new id, query[92], pAka[128*10], DBResult:result;
1225
1226 if(sscanf(params, "u", id))
1227 return print("USAGE: /rcon aka [playerid]"), 1;
1228
1229 if(id == INVALID_PLAYER_ID)
1230 return print("ERROR: Player not connected."), 1;
1231
1232 format(query, sizeof(query), "SELECT * FROM `aka` WHERE `ip` = '%s'", User[id][accountIP]);
1233 result = db_query(Database, query);
1234
1235 if(db_num_rows(result))
1236 {
1237 db_get_field_assoc(result, "name", pAka, sizeof(pAka));
1238
1239 printf("[AKA] %s's other aliases... (%s)", pName(id), User[id][accountIP]);
1240 printf("[AKA] %s", pAka);
1241 }
1242 else
1243 {
1244 printf("ERROR: IP (%s) isn't found on the database.", User[id][accountIP]);
1245 }
1246 db_free_result(result);
1247 return 1;
1248}
1249#endif
1250
1251RCON:settemplevel(params[])
1252{
1253 new string[128], id, level;
1254
1255 if(sscanf(params, "ud", id, level))
1256 return print("USAGE: /rcon settemplevel [playerid] [level]"), 1;
1257
1258 if(id == INVALID_PLAYER_ID)
1259 return print("ERROR: Player not connected."), 1;
1260
1261 if(level < 0 || level > 5)
1262 return print("ERROR: Levels shouldn't go below zero and shouldn't go above five."), 1;
1263
1264 if(level == User[id][accountAdmin])
1265 return print("ERROR: Player is already in that level."), 1;
1266
1267 if(!User[id][accountLogged])
1268 return print("ERROR: Player not logged in."), 1;
1269
1270 if(User[id][accountAdmin] < level)
1271 {
1272 format(string, sizeof(string), "You have been temporarily-promoted to level %d by someone from the panel.", level);
1273 SendClientMessage(id, COLOR_YELLOW, string);
1274 printf("[Promoted] You have temporarily-promoted %s to level %d.", pName(id), level);
1275 format(string, sizeof(string), "You will be promoted back to your old level which is (%d) once you logout.", User[id][accountAdmin]);
1276 SendClientMessage(id, COLOR_GREEN, string);
1277 }
1278 else if(User[id][accountAdmin] > level)
1279 {
1280 format(string, sizeof(string), "You have been temporarily-demoted to level %d by someone from the panel.", level);
1281 SendClientMessage(id, COLOR_YELLOW, string);
1282 printf("[Demoted] You have temporarily-demoted %s to level %d.", pName(id), level);
1283 format(string, sizeof(string), "You will be promoted back to your old level which is (%d) once you logout.", User[id][accountAdmin]);
1284 SendClientMessage(id, COLOR_GREEN, string);
1285 }
1286
1287 User[id][accountTemporary] = true;
1288 User[id][accountAdminEx] = User[id][accountAdmin];
1289 User[id][accountAdmin] = level;
1290
1291 format(string, sizeof string, "Someone from the panel has set %s's administrative level to %d", pName(id), level);
1292 SaveLog("account.txt", string);
1293
1294 SaveData(id); //Saving the whole data
1295 return 1;
1296}
1297
1298RCON:setlevel(params[])
1299{
1300 new id, level, string[128];
1301
1302 if(sscanf(params, "ud", id, level))
1303 return print("USAGE: /rcon setlevel [playerid] [level]"), 1;
1304
1305 if(id == INVALID_PLAYER_ID)
1306 return print("ERROR: Player not connected."), 1;
1307
1308 if(level < 0 || level > 5)
1309 return print("ERROR: Levels shouldn't go below zero and shouldn't go above five."), 1;
1310
1311 if(level == User[id][accountAdmin])
1312 return print("ERROR: Player is already in that level."), 1;
1313
1314 if(!User[id][accountLogged])
1315 return print("ERROR: Player not logged in."), 1;
1316
1317 if(User[id][accountAdmin] < level)
1318 {
1319 format(string, sizeof(string), "You have been promoted to level %d by someone from the panel.", level);
1320 SendClientMessage(id, COLOR_YELLOW, string);
1321 printf("[Promoted] You have promoted %s to level %d.", pName(id), level);
1322 }
1323 else if(User[id][accountAdmin] > level)
1324 {
1325 format(string, sizeof(string), "You have been demoted to level %d by someone from the panel.", level);
1326 SendClientMessage(id, COLOR_YELLOW, string);
1327 printf("[Demoted] You have demoted %s to level %d.", pName(id), level);
1328 }
1329
1330 if(User[id][accountTemporary])
1331 {
1332 print("NOTE: The effect of /settemplevel has been removed since you used /setlevel on this player.");
1333 }
1334
1335 User[id][accountTemporary] = false;
1336 User[id][accountAdminEx] = 0;
1337 User[id][accountAdmin] = level;
1338
1339 format(string, sizeof string, "Someone in the panel has set %s's administrative level to %d", pName(id), level);
1340 SaveLog("account.txt", string);
1341
1342 SaveData(id); //Saving the whole data
1343 return 1;
1344}
1345
1346//============================================================================//
1347
1348public OnPlayerCommandReceived(playerid, cmdtext[])
1349{
1350 new string[128];
1351
1352 User[playerid][accountAFK] = 0;
1353
1354 #if defined PRINT_CMD
1355 printf("[cmd] %s typed: %s", pName(playerid), cmdtext);
1356 #endif
1357
1358 if(ServerInfo[AntiSpam])
1359 {
1360 if((!User[playerid][accountAdmin] && !IsPlayerAdmin(playerid)))
1361 {
1362 if((GetTickCount() - User[playerid][SpamTime]) < SPAM_TIMELIMIT)
1363 {
1364 format(string, sizeof(string), "* You have to wait for %d seconds before you can send another chat/command.", SPAM_TIMELIMIT);
1365 SendClientMessage(playerid, COLOR_RED, string);
1366 return 0;
1367 }
1368 }
1369 User[playerid][SpamTime] = GetTickCount();
1370 }
1371
1372 if(ServerInfo[ReadCmds])
1373 {
1374 if(!ServerInfo[ReadCmd])
1375 {
1376 if(strfind(cmdtext, "cpass", true) == -1 || strfind(cmdtext, "register", true) == -1 || strfind(cmdtext, "login", true) == -1 || strfind(cmdtext, "setpass", true) == -1)
1377 {
1378 format(string, sizeof(string), "* %s used cmd:"white" %s", pName(playerid), cmdtext);
1379 foreach(new i : Player)
1380 {
1381 if(User[i][accountAdmin] >= 1 && User[i][accountAdmin] > User[playerid][accountAdmin] && i != playerid)
1382 {
1383 SendClientMessage(i, COLOR_GREEN, string);
1384 }
1385 }
1386 }
1387 }
1388 else
1389 {
1390 foreach(new x : Player)
1391 {
1392 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
1393 {
1394 if(strfind(cmdtext, "cpass", true) == -1 || strfind(cmdtext, "register", true) == -1 || strfind(cmdtext, "login", true) == -1 || strfind(cmdtext, "setpass", true) == -1)
1395 {
1396 format(string, sizeof(string), "* %s used cmd:"white" %s", pName(playerid), cmdtext);
1397 SendClientMessage(x, COLOR_GREEN, string);
1398 }
1399 }
1400 }
1401 }
1402 }
1403
1404 if(ServerInfo[AntiAd])
1405 {
1406 if(IsAdvertisement(cmdtext))
1407 {
1408 format(string, sizeof(string), "Warning: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, cmdtext);
1409 SendAdmin(COLOR_RED, string);
1410 return 0;
1411 }
1412 }
1413
1414 if(User[playerid][accountCMuted])
1415 {
1416 if(User[playerid][accountCMuteSec] > 0)
1417 {
1418 format(string, sizeof(string), "You are muted from using the commands, You can use commands in %d seconds.", User[playerid][accountCMuteSec]);
1419 SendClientMessage(playerid, COLOR_ORANGE, string);
1420 }
1421 else if(User[playerid][accountCMuteSec] == -1) SendClientMessage(playerid, COLOR_ORANGE, "You are permanently muted from using commands.");
1422 return 0;
1423 }
1424 return 1;
1425}
1426
1427//============================================================================//
1428// Administrative Level 1-5 //
1429//============================================================================//
1430
1431CMD:hideme(playerid, params[])
1432{
1433 LoginCheck(playerid);
1434 LevelCheck(playerid, 1);
1435
1436 switch(User[playerid][accountHide])
1437 {
1438 case false:
1439 {
1440 SendClientMessage(playerid, -1, "You are now "green"hidden"white" from the admins list.");
1441 User[playerid][accountHide] = true;
1442 }
1443 case true:
1444 {
1445 SendClientMessage(playerid, -1, "You are "red"visible"white" again in the admins list.");
1446 User[playerid][accountHide] = false;
1447 }
1448 }
1449 return 1;
1450}
1451
1452CMD:jacmds(playerid, params[])
1453{
1454 static string[128 * 15], cb[64];
1455 string[0] = 0;
1456 cb[0] = 0;
1457
1458 LoginCheck(playerid);
1459 LevelCheck(playerid, 1);
1460
1461 if(User[playerid][accountAdmin] >= 1)
1462 {
1463 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank1]);
1464 strcat(string, cb);
1465 strcat(string, ""white"");
1466 strcat(string, "* /announce /kick /asay /settime /setweather /goto /ip /spawn /gotoco /flip /warn /remwarn /addnos\n");
1467 strcat(string, "* /repair (/reports /handlereport /denyreport /endreport /reporttalk) /aduty /weaps\n");
1468 strcat(string, "* /votekicktime /endvotekick /setwanted /setdlevel /entercar /saveskin /useskin /checkdamage\n");
1469 strcat(string, "* /tabbed /afk /richlist (/o)aka /god /hideme /laston /ostats\n");
1470 strcat(string, "*** {D0AEEB}Admin Chat: {FFD700}#"white" (Usage; #Hi I am Richie)\n\n");
1471 }
1472 if(User[playerid][accountAdmin] >= 2)
1473 {
1474 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank2]);
1475 strcat(string, cb);
1476 strcat(string, ""white"");
1477 strcat(string, "* /disarm /explode /setinterior /setworld /heal /armour /clearchat /setskin /mute /unmute\n");
1478 strcat(string, "* /akill /spec /car /carcolor /eject /setvhealth /givecar /muted /jailed (/un)jail\n");
1479 strcat(string, "* /aweapons /jetpack /carpjob /addlabel /destroylabel /gotolabel /radiusrespawn (/rr)\n");
1480 strcat(string, "* /respawncar /ips /checkbreach (/un)cage /caged\n\n");
1481 }
1482 if(User[playerid][accountAdmin] >= 3)
1483 {
1484 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank3]);
1485 strcat(string, cb);
1486 strcat(string, ""white"");
1487 strcat(string, "* /setmoney /setscore /setcolor /slap /cname /(un)banip /giveweapon (/un)freeze /getall /bankrupt\n");
1488 strcat(string, "* /teleplayer /destroycar /sethealth /setfstyle /healall /armourall /force /checkban\n");
1489 strcat(string, "* /write /get /oban, /forbidword, /crash, /setvotekicklimit /hidemarker /setchocolate\n");
1490 strcat(string, "* /jconfig\n\n");
1491 }
1492 if(User[playerid][accountAdmin] >= 4)
1493 {
1494 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank4]);
1495 strcat(string, cb);
1496 strcat(string, ""white"");
1497 strcat(string, "* /saveallstats /cleardwindow /respawncars /setallweather /setalltime /giveallweapon\n");
1498 strcat(string, "* /giveallcash /giveallscore /kickall /disarmall /ejectall /mutecmd /unmutecmd\n");
1499 strcat(string, "* /setallskin /fakedeath /cmdmuted /lockchat /giveallchocolate /reloadcfg\n");
1500 strcat(string, "* /gmx /setonline /jsettings /setpass\n");
1501 strcat(string, "*** {D0AEEB}Lead Admin Chat: {FFD700}@"white" (Usage; @What's up losers?!)\n\n");
1502 }
1503 if(User[playerid][accountAdmin] >= 5 || IsPlayerAdmin(playerid))
1504 {
1505 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank5]);
1506 strcat(string, cb);
1507 strcat(string, ""white"");
1508 strcat(string, "* /set(temp)level /fakechat /fakecmd /makemegodadmin (/create/remove/set)account /rcons");
1509 }
1510
1511 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""grey"Admin Commands", string, "Close", "");
1512 return 1;
1513}
1514
1515//============================================================================//
1516// Administrative Level One //
1517//============================================================================//
1518
1519CMD:ostats(playerid, params[])
1520{
1521 LoginCheck(playerid);
1522 LevelCheck(playerid, 1);
1523
1524 new name[24];
1525 if(sscanf(params, "s[24]", name))
1526 return SendClientMessage(playerid, COLOR_RED, "USAGE: /ostats [name]");
1527
1528 Offline_ShowStatistics(playerid, name);
1529 return 1;
1530}
1531
1532CMD:laston(playerid, params[])
1533{
1534 LoginCheck(playerid);
1535 LevelCheck(playerid, 1);
1536
1537 new query[128], accountname[24], DBResult:result, laston[32], id;
1538
1539 if(sscanf(params, "s[24]", accountname))
1540 return SendClientMessage(playerid, COLOR_RED, "USAGE: /laston [account name]");
1541
1542 id = ReturnUser(accountname);
1543 if(IsPlayerConnected(id))
1544 {
1545 format(query, sizeof(query), "** %s was last seen "green"today. "white"They are "green"online "white"in the server "red"right now.", pName(id));
1546 SendClientMessage(playerid, -1, query);
1547 }
1548 else
1549 {
1550 format(query, sizeof(query), "SELECT `laston` FROM `users` WHERE `username` = '%s'", DB_Escape(accountname));
1551 result = db_query(Database, query);
1552 if(db_num_rows(result))
1553 {
1554 db_get_field_assoc(result, "laston", laston, 32);
1555 format(query, sizeof(query), "** %s was last seen on "red"%s"white".", accountname, laston);
1556 SendClientMessage(playerid, -1, query);
1557 }
1558 else
1559 {
1560 format(query, sizeof(query), "* '%s' isn't found in the database." ,accountname);
1561 SendClientMessage(playerid, COLOR_RED, query);
1562 }
1563 db_free_result(result);
1564 }
1565 return 1;
1566}
1567
1568CMD:god(playerid, params[])
1569{
1570 LoginCheck(playerid);
1571 LevelCheck(playerid, 1);
1572
1573 switch(User[playerid][accountGod])
1574 {
1575 case false:
1576 {
1577 //Removal of the weapons has been made.
1578 SendClientMessage(playerid, COLOR_GREEN, "God Mode On!");
1579 User[playerid][accountGod] = true;
1580 }
1581 case true:
1582 {
1583 User[playerid][accountGod] = false;
1584 SendClientMessage(playerid, COLOR_RED, "God Mode Off!");
1585 SetPlayerHealth(playerid, 100.0);
1586 }
1587 }
1588 return 1;
1589}
1590
1591#if defined USE_AKA
1592CMD:oaka(playerid, params[])
1593{
1594 new ip[20], query[92], pAka[128*10], string[128 * 10], DBResult:result;
1595
1596 LoginCheck(playerid);
1597 LevelCheck(playerid, 1);
1598
1599 if(sscanf(params, "s[20]", ip))
1600 return SendClientMessage(playerid, COLOR_RED, "USAGE: /oaka [IP]");
1601
1602 format(query, sizeof(query), "SELECT * FROM `aka` WHERE `ip` = '%s'", ip);
1603 result = db_query(Database, query);
1604
1605 if(db_num_rows(result))
1606 {
1607 db_get_field_assoc(result, "name", pAka, sizeof(pAka));
1608
1609 format(string, sizeof(string), "Aliases under the IP of %s...", ip);
1610 SendClientMessage(playerid, -1, string);
1611 format(string, sizeof(string), "%s", pAka);
1612 SendClientMessage(playerid, COLOR_YELLOW, string);
1613 }
1614 else
1615 {
1616 format(string, sizeof(string), "IP (%s) isn't found on the database.", ip);
1617 SendClientMessage(playerid, COLOR_RED, string);
1618 }
1619 db_free_result(result);
1620 return 1;
1621}
1622
1623CMD:aka(playerid, params[])
1624{
1625 new id, query[92], pAka[128*10], string[128 * 10], DBResult:result;
1626
1627 LoginCheck(playerid);
1628 LevelCheck(playerid, 1);
1629
1630 if(sscanf(params, "u", id))
1631 return SendClientMessage(playerid, COLOR_RED, "USAGE: /aka [playerid]");
1632
1633 if(id == INVALID_PLAYER_ID)
1634 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1635
1636 if(User[playerid][accountAdmin] < User[id][accountAdmin] && id != playerid)
1637 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1638
1639 format(query, sizeof(query), "SELECT * FROM `aka` WHERE `ip` = '%s'", User[id][accountIP]);
1640 result = db_query(Database, query);
1641
1642 if(db_num_rows(result))
1643 {
1644 db_get_field_assoc(result, "name", pAka, sizeof(pAka));
1645
1646 format(string, sizeof(string), "%s's other aliases... (%s)", pName(id), User[id][accountIP]);
1647 SendClientMessage(playerid, -1, string);
1648 format(string, sizeof(string), "%s", pAka);
1649 SendClientMessage(playerid, COLOR_YELLOW, string);
1650 }
1651 else
1652 {
1653 format(string, sizeof(string), "IP (%s) isn't found on the database.", User[id][accountIP]);
1654 SendClientMessage(playerid, COLOR_RED, string);
1655 }
1656 db_free_result(result);
1657 return 1;
1658}
1659#endif
1660
1661CMD:richlist(playerid, params[])
1662{
1663 LoginCheck(playerid);
1664 LevelCheck(playerid, 1);
1665
1666 new array[MAX_PLAYERS][2];
1667 new count;
1668 new string[128];
1669
1670 foreach(new i : Player)
1671 {
1672 array[count][0] = GetPlayerMoney(i);
1673 array[count][1] = i;
1674 count++;
1675 }
1676
1677 QuickSort_Pair(array, true, 0, count);
1678
1679 SendClientMessage(playerid, COLOR_YELLOW, "* Top 5 richest players:");
1680 for (new i, j = ((count > 5) ? (5) : (count)); i < j; i++)
1681 {
1682 format(string, sizeof (string), "%i. %s[%i] - $%i", (i + 1), pName(array[i][1]), array[i][1], array[i][0]);
1683 SendClientMessage(playerid, -1, string);
1684 }
1685 return 1;
1686}
1687
1688CMD:afk(playerid, params[])
1689{
1690 LoginCheck(playerid);
1691 LevelCheck(playerid, 1);
1692
1693 new string[128];
1694
1695 SendClientMessage(playerid, COLOR_RED, "* Idle Players:");
1696 foreach(new i : Player)
1697 {
1698 if(User[i][accountAFK] > 0)
1699 {
1700 format(string, sizeof(string), "* %s (ID: %d) - %d seconds", pName(i), i, User[i][accountAFK]);
1701 SendClientMessage(playerid, -1, string);
1702 }
1703 }
1704 return 1;
1705}
1706
1707CMD:tabbed(playerid, params[])
1708{
1709 LoginCheck(playerid);
1710 LevelCheck(playerid, 1);
1711
1712 new string[128];
1713
1714 SendClientMessage(playerid, COLOR_RED, "* Tabbed Players:");
1715 foreach(new i : Player)
1716 {
1717 if(User[i][accountTabbed] > 0)
1718 {
1719 format(string, sizeof(string), "* %s (ID: %d) - %d seconds", pName(i), i, User[i][accountTabbed]);
1720 SendClientMessage(playerid, -1, string);
1721 }
1722 }
1723 return 1;
1724}
1725
1726CMD:checkdamage(playerid, params[])
1727{
1728 LoginCheck(playerid);
1729 LevelCheck(playerid, 1);
1730
1731 new string[128], wName[32], userid;
1732
1733 if(sscanf(params, "u", userid))
1734 return SendClientMessage(playerid, COLOR_RED, "USAGE: /checkdamage [playerid]");
1735
1736 if(userid == INVALID_PLAYER_ID)
1737 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1738
1739 format(string, sizeof(string), "* Last 5 Players that Damaged %s:", pName(userid));
1740 SendClientMessage(playerid, COLOR_YELLOW, string);
1741 for(new i; i < 5; i++)
1742 {
1743 if(!isnull(DamagedPlayer[userid][i]))
1744 {
1745 GetWeaponName(DamagedWeapon[userid][i], wName, sizeof(wName));
1746 format(string, sizeof(string), "[%d] %s damaged the player with weapon %s. (%d seconds ago)", i + 1, DamagedPlayer[userid][i], wName, gettime()-DamagedStamp[userid][i]);
1747 SendClientMessage(playerid, COLOR_GREEN, string);
1748 }
1749 else
1750 {
1751 format(string, sizeof(string), "[%d] No one damaged them yet on this slot.", i + 1);
1752 SendClientMessage(playerid, COLOR_GREEN, string);
1753 }
1754 }
1755 return 1;
1756}
1757
1758CMD:saveskin(playerid, params[])
1759{
1760 LoginCheck(playerid);
1761 LevelCheck(playerid, 1);
1762
1763 new string[128], SkinID;
1764
1765 if(sscanf(params, "d", SkinID))
1766 return SendClientMessage(playerid, COLOR_RED, "USAGE: /saveskin [skinid]");
1767
1768 if(SkinID < 0 || SkinID == 74 || SkinID > 311)
1769 return SendClientMessage(playerid, COLOR_RED, "* Invalid SkinID");
1770
1771 User[playerid][accountSkin] = SkinID;
1772 SaveData(playerid);
1773
1774 format(string, sizeof(string), "You have successfully saved skinID %d", SkinID);
1775 SendClientMessage(playerid, -1, string);
1776 SendClientMessage(playerid, COLOR_YELLOW, "Type: /useskin to use this skin when you spawn (use the same cmd to stop using saved-skin)");
1777 return 1;
1778}
1779
1780CMD:useskin(playerid, params[])
1781{
1782 LoginCheck(playerid);
1783 LevelCheck(playerid, 1);
1784
1785 if(User[playerid][accountSkin] == -1)
1786 return SendClientMessage(playerid, COLOR_RED, "* You do not have any saved skin.");
1787
1788 switch(User[playerid][accountUseSkin])
1789 {
1790 case false:
1791 {
1792 User[playerid][accountUseSkin] = true;
1793 SetPlayerSkin(playerid, User[playerid][accountSkin]);
1794 SendClientMessage(playerid, COLOR_GREEN, "Your favorite skin is now in use.");
1795 }
1796 case true:
1797 {
1798 User[playerid][accountUseSkin] = false;
1799 SendClientMessage(playerid, COLOR_RED, "Your favorite skin will be no longer in use upon spawning.");
1800 }
1801 }
1802 SaveData(playerid);
1803 return 1;
1804}
1805
1806CMD:votekicktime(playerid, params[])
1807{
1808 new string[128], second;
1809
1810 LoginCheck(playerid);
1811 LevelCheck(playerid, 1);
1812
1813 if(sscanf(params, "i", second))
1814 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvotekicklimit [limit(30/300)]");
1815
1816 if(second < 30 || second > 300)
1817 return SendClientMessage(playerid, COLOR_RED, "* The kick-time must be above 30 seconds, but below 300!");
1818
1819 if(second == KickTime)
1820 {
1821 format(string, sizeof(string), "* The vote-kick time is already %i seconds!", second);
1822 return SendClientMessage(playerid, COLOR_RED, string);
1823 }
1824
1825 format(string, sizeof(string), "* Admin %s (ID: %d) has changed the Vote-Kick Time to %d.", pName(playerid), playerid, second);
1826 SendClientMessageToAll(COLOR_ADMIN, string);
1827 SaveLog("votekick.txt", string);
1828 KickTime = second;
1829 return 1;
1830}
1831
1832CMD:entercar(playerid, params[])
1833{
1834 new string[128], id;
1835
1836 LoginCheck(playerid);
1837 LevelCheck(playerid, 1);
1838
1839 if(sscanf(params, "d", id))
1840 return SendClientMessage(playerid, COLOR_RED, "USAGE: /entercar [vehicleid]");
1841
1842 if(id < 1 || !IsValidVehicle(id) || id > MAX_VEHICLES)
1843 return SendClientMessage(playerid, COLOR_RED, "* Invalid vehicleID.");
1844
1845 if(!IsSeatAvailable(id, 0))
1846 return SendClientMessage(playerid, COLOR_RED, "* That seat is occupied.");
1847
1848 PutPlayerInVehicle(playerid, id, 0);
1849 format(string, sizeof(string), "* You have teleported and is now a driver of vehicle ID %d.", id);
1850 SendClientMessage(playerid, -1, string);
1851 return 1;
1852}
1853
1854CMD:setwanted(playerid, params[])
1855{
1856 new string[128], id, level;
1857
1858 LoginCheck(playerid);
1859 LevelCheck(playerid, 1);
1860
1861 if(sscanf(params, "ui", id, level))
1862 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setwanted [playerid] [level(0-6)]");
1863
1864 if(id == INVALID_PLAYER_ID)
1865 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1866
1867 if(level < 0 || level > 6)
1868 return SendClientMessage(playerid, COLOR_RED, "* Invalid wanted level.");
1869
1870 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1871 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1872
1873 format(string, sizeof(string), "* Admin %s has set your wanted level to %d.", pName(playerid), level);
1874 SendClientMessage(id, COLOR_YELLOW, string);
1875 format(string, sizeof(string), "* You have set %s's wanted level to %d.", pName(id), level);
1876 SendClientMessage(playerid, COLOR_YELLOW, string);
1877 SetPlayerWantedLevel(id, level);
1878 return 1;
1879}
1880
1881CMD:setdlevel(playerid, params[])
1882{
1883 new string[128], id, level;
1884
1885 LoginCheck(playerid);
1886 LevelCheck(playerid, 1);
1887
1888 if(sscanf(params, "ui", id, level))
1889 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setdlevel [playerid] [level(0-50,000)]");
1890
1891 if(id == INVALID_PLAYER_ID)
1892 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1893
1894 if(level < 0 || level > 50000)
1895 return SendClientMessage(playerid, COLOR_RED, "* Invalid drunk level.");
1896
1897 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1898 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1899
1900 format(string, sizeof(string), "* Admin %s has set your drunk level to %d.", pName(playerid), level);
1901 SendClientMessage(id, COLOR_YELLOW, string);
1902 format(string, sizeof(string), "* You have set %s's drunk level to %d.", pName(id), level);
1903 SendClientMessage(playerid, COLOR_YELLOW, string);
1904 SetPlayerDrunkLevel(id, level);
1905 return 1;
1906}
1907
1908CMD:endvotekick(playerid, params[])
1909{
1910 new string[128], reason[38];
1911
1912 LoginCheck(playerid);
1913 LevelCheck(playerid, 1);
1914
1915 if(!VoteKickHappening)
1916 return SendClientMessage(playerid, COLOR_RED, "* There is no vote-kick happening at this time.");
1917
1918 if(sscanf(params, "s[38]", reason))
1919 return SendClientMessage(playerid, COLOR_RED, "USAGE: /endvotekick [reason]");
1920
1921 format(string, sizeof(string), "* Admin %s has ended the vote-kick against %s reason: (%s)", pName(playerid), pName(VoteKickTarget), reason);
1922 SendClientMessageToAll(COLOR_ADMIN, string);
1923 SaveLog("votekick.txt", string);
1924
1925 format(VoteKickReason, sizeof(VoteKickReason), "None");
1926 VoteKickHappening = 0;
1927 avotes = 0;
1928 svotes = 0;
1929 VoteKickTarget = INVALID_PLAYER_ID;
1930 KillTimer(VoteTimer);
1931 //////////////////////
1932 foreach(new i : Player)
1933 {
1934 HasAlreadyVoted{i} = false;
1935 }
1936 return 1;
1937}
1938
1939CMD:weaps(playerid, params[])
1940{
1941 LoginCheck(playerid);
1942 LevelCheck(playerid, 1);
1943
1944 new id, Count, x, string[128], WeapName[24], slot, weap, ammo;
1945 if(sscanf(params, "u", id))
1946 return SendClientMessage(playerid, COLOR_RED, "USAGE: /weaps [playerid]");
1947
1948 if(id == INVALID_PLAYER_ID)
1949 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1950
1951 format(string, sizeof(string), "%s's Weapons...", pName(id));
1952 SendClientMessage(playerid, COLOR_WHITE, string);
1953 for(slot = 0; slot < 14; slot++)
1954 {
1955 GetPlayerWeaponData(id, slot, weap, ammo);
1956 if(ammo != 0 && weap != 0)
1957 Count++;
1958 }
1959 if(Count < 1) return SendClientMessage(playerid, COLOR_RED, "Players has no equipped weapons!");
1960 if(Count >= 1)
1961 {
1962 for (slot = 0; slot < 14; slot++)
1963 {
1964 GetPlayerWeaponData(id, slot, weap, ammo);
1965 if(ammo != 0 && weap != 0)
1966 {
1967 GetWeaponName(weap, WeapName, sizeof(WeapName));
1968 if(ammo == 65535 || ammo == 1)
1969 format(string, sizeof(string), "%s%s (1)",string, WeapName);
1970 else format(string, sizeof(string), "%s%s (%d)", string, WeapName, ammo);
1971 x++;
1972 if(x >= 5)
1973 {
1974 SendClientMessage(playerid, COLOR_YELLOW, string);
1975 x = 0;
1976 format(string, sizeof(string), "");
1977 }
1978 else format(string, sizeof(string), "%s, ", string);
1979 }
1980 }
1981 if(x <= 4 && x > 0)
1982 {
1983 string[strlen(string)-3] = '.';
1984 SendClientMessage(playerid, COLOR_YELLOW, string);
1985 }
1986 }
1987 return 1;
1988}
1989
1990CMD:aduty(playerid, params[])
1991{
1992 LoginCheck(playerid);
1993 LevelCheck(playerid, 1);
1994
1995 new string[92];
1996
1997 switch(User[playerid][accountDuty])
1998 {
1999 case 0:
2000 {
2001 SetPlayerArmour(playerid, 100000);
2002 SetPlayerHealth(playerid, 100000);
2003 User[playerid][accountDuty] = 1;
2004 format(string, sizeof(string), "* Admin %s goes Admin-Duty", pName(playerid));
2005 SendClientMessageToAll(COLOR_ADMIN, string);
2006 }
2007 case 1:
2008 {
2009 User[playerid][accountDuty] = 0;
2010 SetPlayerHealth(playerid, 100);
2011 SetPlayerArmour(playerid, 100);
2012 format(string, sizeof(string), "* Admin %s goes off Admin-Duty", pName(playerid));
2013 SendClientMessageToAll(COLOR_ADMIN, string);
2014 }
2015 }
2016 return 1;
2017}
2018
2019CMD:reports(playerid, params[])
2020{
2021 // /reports has been reworked too (01/22/17)
2022
2023 LoginCheck(playerid);
2024 LevelCheck(playerid, 1);
2025
2026 new string[1042 * 5], string2[150], count;
2027
2028 strcat(string, ""red"*** Report Send by the Players ***\n\n");
2029 strcat(string, ""grey"");
2030
2031 for(new i = 1; i< MAX_REPORTS; i++)
2032 {
2033 if(rInfo[i][reportTaken])
2034 {
2035 if(IsPlayerConnected(rInfo[i][reportAccepted]))
2036 {
2037 format(string2, sizeof(string2), "[ReportID %d] %s(%d) reported %s(%d) for %s (submitted: %s) - handled by %s\n", i, pName(rInfo[i][reporterID]), rInfo[i][reporterID], pName(rInfo[i][reportedID]), rInfo[i][reportedID], rInfo[i][reportReason], rInfo[i][reportTime], pName(rInfo[i][reportAccepted]));
2038 }
2039 else if(rInfo[i][reportAccepted] == INVALID_PLAYER_ID)
2040 {
2041 format(string2, sizeof(string2), "[ReportID %d] %s(%d) reported %s(%d) for %s (submitted: %s) - handled by no one\n", i, pName(rInfo[i][reporterID]), rInfo[i][reporterID], pName(rInfo[i][reportedID]), rInfo[i][reportedID], rInfo[i][reportReason], rInfo[i][reportTime]);
2042 }
2043 strcat(string, string2);
2044 count++;
2045 }
2046 }
2047
2048 if(count < 1) strcat(string, "There are no reports at the moment.");
2049
2050 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"Reports", string, "Close", "");
2051 return 1;
2052}
2053
2054CMD:handlereport(playerid, params[])
2055{
2056 LoginCheck(playerid);
2057 LevelCheck(playerid, 1);
2058
2059 new reportid;
2060 if(sscanf(params, "d", reportid))
2061 return SendClientMessage(playerid, COLOR_RED, "USAGE: /handlereport [reportid]");
2062
2063 if(reportid < 1 || !rInfo[reportid][reportTaken] || reportid >= MAX_REPORTS)
2064 return SendClientMessage(playerid, COLOR_RED, "** Invalid reportID specified.");
2065
2066 if(rInfo[reportid][reportAccepted] == playerid)
2067 return SendClientMessage(playerid, COLOR_RED, "** Report is already being handle by you.");
2068
2069 if(rInfo[reportid][reportAccepted] != INVALID_PLAYER_ID)
2070 return SendClientMessage(playerid, COLOR_RED, "** Report is already being handle by another admin.");
2071
2072 HandleReport(playerid, reportid);
2073 return 1;
2074}
2075
2076CMD:denyreport(playerid, params[])
2077{
2078 LoginCheck(playerid);
2079 LevelCheck(playerid, 1);
2080
2081 new reportid, reason[128];
2082 if(sscanf(params, "ds[128]", reportid))
2083 return SendClientMessage(playerid, COLOR_RED, "USAGE: /denyreport [reportid]");
2084
2085 if(reportid < 1 || !rInfo[reportid][reportTaken] || reportid >= MAX_REPORTS)
2086 return SendClientMessage(playerid, COLOR_RED, "** Invalid reportID specified.");
2087
2088 if(rInfo[reportid][reportAccepted] != INVALID_PLAYER_ID)
2089 return SendClientMessage(playerid, COLOR_RED, "** Report is already being handle by another admin.");
2090
2091 DenyReport(playerid, reportid, reason);
2092 return 1;
2093}
2094
2095CMD:endreport(playerid, params[])
2096{
2097 LoginCheck(playerid);
2098 LevelCheck(playerid, 1);
2099
2100 new reason[128];
2101 if(sscanf(params, "s[128]", reason))
2102 return SendClientMessage(playerid, COLOR_RED, "USAGE: /endreport [reason]");
2103
2104 for(new i; i < MAX_REPORTS; i++)
2105 {
2106 if(rInfo[i][reportTaken] && rInfo[i][reportAccepted] == playerid)
2107 {
2108 EndReport(playerid, i, reason);
2109 return 1;
2110 }
2111 }
2112 SendClientMessage(playerid, -1, "* You aren't handling any reports.");
2113 return 1;
2114}
2115
2116CMD:repair(playerid, params[])
2117{
2118 LoginCheck(playerid);
2119 LevelCheck(playerid, 1);
2120
2121 if(IsPlayerInAnyVehicle(playerid))
2122 {
2123 new VehicleID = GetPlayerVehicleID(playerid);
2124 RepairVehicle(VehicleID);
2125 GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~Vehicle ~g~Repaired!", 3000, 3);
2126 SetVehicleHealth(VehicleID, 1000.0);
2127 }
2128 else
2129 SendClientMessage(playerid, COLOR_RED, "* You must be inside of the vehicle to use this command.");
2130 return 1;
2131}
2132
2133CMD:addnos(playerid, params[])
2134{
2135 LoginCheck(playerid);
2136 LevelCheck(playerid, 1);
2137
2138 if(IsPlayerInAnyVehicle(playerid))
2139 {
2140 switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
2141 {
2142 case 448,461,462,463,468,471,509,510,521,522,523,581,586,449: SendClientMessage(playerid, COLOR_RED, "* You cannot add nos to this vehicle.");
2143 }
2144 AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
2145 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
2146 }
2147 else
2148 SendClientMessage(playerid, COLOR_RED, "* You must be inside of the vehicle to use this command.");
2149 return 1;
2150}
2151
2152CMD:warn(playerid, params[])
2153{
2154 LoginCheck(playerid);
2155 LevelCheck(playerid, 1);
2156
2157 new string[128], id, reason[128], rank[3];
2158
2159 if(sscanf(params, "uS(No Reason)[128]", id, reason))
2160 return SendClientMessage(playerid, COLOR_RED, "USAGE: /warn [playerid] [reason]");
2161
2162 if(id == INVALID_PLAYER_ID)
2163 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2164
2165 if(id == playerid)
2166 return SendClientMessage(playerid, COLOR_RED, "* You cannot warn yourself.");
2167
2168 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2169 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2170
2171 User[id][accountWarn] += 1;
2172 switch(User[id][accountWarn])
2173 {
2174 case 1: rank = "st";
2175 case 2: rank = "nd";
2176 case 3: rank = "rd";
2177 default: rank = "th";
2178 }
2179
2180 format(string, sizeof(string), "[WARNED] %s has been warned by %s for the %d%s time for %s.", pName(id), pName(playerid), User[id][accountWarn], rank, reason);
2181 SendClientMessageToAll(COLOR_ADMIN, string);
2182 return 1;
2183}
2184
2185CMD:remwarn(playerid, params[])
2186{
2187 LoginCheck(playerid);
2188 LevelCheck(playerid, 1);
2189
2190 new string[128], id, rank[3];
2191
2192 if(sscanf(params, "u", id))
2193 return SendClientMessage(playerid, COLOR_RED, "USAGE: /remwarn [playerid]");
2194
2195 if(id == INVALID_PLAYER_ID)
2196 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2197
2198 if(id == playerid)
2199 return SendClientMessage(playerid, COLOR_RED, "* You cannot remove warn yourself.");
2200
2201 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2202 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2203
2204 if(User[id][accountWarn] == 0)
2205 return SendClientMessage(playerid, COLOR_RED, "* Player has no warnings.");
2206
2207 switch(User[id][accountWarn])
2208 {
2209 case 1: rank = "st";
2210 case 2: rank = "nd";
2211 case 3: rank = "rd";
2212 default: rank = "th";
2213 }
2214
2215 format(string, sizeof(string), "[REMWARN] %s %d%s warning has been removed by %s.", pName(id), User[id][accountWarn], rank, pName(playerid));
2216 SendClientMessageToAll(COLOR_ADMIN, string);
2217
2218 User[id][accountWarn] -= 1;
2219 return 1;
2220}
2221
2222CMD:flip(playerid, params[])
2223{
2224 LoginCheck(playerid);
2225 LevelCheck(playerid, 1);
2226
2227 new id, string[128], Float:angle;
2228
2229 if(!sscanf(params, "u", id))
2230 {
2231 if(id == INVALID_PLAYER_ID)
2232 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2233
2234 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2235 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2236 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player not in a vehicle.");
2237 GetVehicleZAngle(GetPlayerVehicleID(id), angle);
2238 SetVehicleZAngle(GetPlayerVehicleID(id), angle);
2239
2240 format(string, sizeof(string), "You have flipped Player %s's vehicle.", pName(id));
2241 SendClientMessage(playerid, COLOR_GREEN, string);
2242 format(string, sizeof(string), "Admin %s has flipped your vehicle.", pName(playerid));
2243 SendClientMessage(id, COLOR_GREEN, string);
2244 }
2245 else
2246 {
2247 if(!IsPlayerInAnyVehicle(playerid))
2248 return SendClientMessage(playerid, COLOR_RED, "* You must be in a vehicle to use /flip.");
2249
2250 GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
2251 SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
2252 SendClientMessage(playerid, COLOR_YELLOW, "Vehicle Flipped!");
2253 SendClientMessage(playerid, -1, "Want to flip player's vehicle? Just do "green"/flip [playerid]");
2254 }
2255 return 1;
2256}
2257
2258CMD:gotoco(playerid, params[])
2259{
2260 LoginCheck(playerid);
2261 LevelCheck(playerid, 1);
2262
2263 new Float: Pos[3], string[128];
2264 if(sscanf(params, "p<,>fff", Pos[0], Pos[1], Pos[2]))
2265 return SendClientMessage(playerid, COLOR_RED, "USAGE: /gotoco [x] [y] [z]");
2266
2267 if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
2268 else SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
2269
2270 format(string, sizeof string, "You have teleported to Coordinates %.1f %.1f %.1f", Pos[0], Pos[1], Pos[2]);
2271 SendClientMessage(playerid, COLOR_YELLOW, string);
2272 return 1;
2273}
2274
2275CMD:ip(playerid, params[])
2276{
2277 LoginCheck(playerid);
2278 LevelCheck(playerid, 1);
2279
2280 new
2281 id,
2282 string[120]
2283 ;
2284 if(sscanf(params, "u", id))
2285 return SendClientMessage(playerid, COLOR_RED, "USAGE: /ip [playerid]");
2286
2287 if(id == INVALID_PLAYER_ID)
2288 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2289
2290 format(string, 120, "> %s's IP: %s <", pName(id), getIP(id));
2291 SendClientMessage(playerid, COLOR_YELLOW, string);
2292 return 1;
2293}
2294
2295CMD:spawn(playerid, params[])
2296{
2297 LoginCheck(playerid);
2298 LevelCheck(playerid, 1);
2299
2300 new
2301 string[128],
2302 id
2303 ;
2304
2305 if(sscanf(params, "u", id))
2306 return SendClientMessage(playerid, COLOR_RED, "USAGE: /spawn [playerid]");
2307
2308 if(id == INVALID_PLAYER_ID)
2309 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2310
2311 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2312 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2313
2314 SetPlayerPos(id, 0.0, 0.0, 0.0);
2315 SpawnPlayer(id);
2316 format(string, sizeof(string), "You have respawned Player %s.", pName(id));
2317 SendClientMessage(playerid, -1, string);
2318 format(string, sizeof(string), "Admin %s has respawned you.", pName(playerid));
2319 SendClientMessage(id, COLOR_YELLOW, string);
2320 return 1;
2321}
2322
2323CMD:goto(playerid, params[])
2324{
2325 LoginCheck(playerid);
2326 LevelCheck(playerid, 1);
2327
2328 new
2329 id,
2330 string[128],
2331 Float:x,
2332 Float:y,
2333 Float:z
2334 ;
2335 if(sscanf(params, "u", id))
2336 return SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [playerid]");
2337
2338 if(id == INVALID_PLAYER_ID)
2339 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2340
2341 GetPlayerPos(id, x, y, z);
2342 SetPlayerInterior(playerid, GetPlayerInterior(id));
2343 SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
2344 if(GetPlayerState(playerid) == 2)
2345 {
2346 SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
2347 LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
2348 SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
2349 }
2350 else SetPlayerPos(playerid, x+2, y, z);
2351 format(string, sizeof(string), "You have been teleported to Player %s.", pName(id));
2352 SendClientMessage(playerid, COLOR_GREEN, string);
2353 format(string, sizeof(string), "Admin %s has teleported to your location.", pName(playerid));
2354 SendClientMessage(id, COLOR_GREEN, string);
2355 return 1;
2356}
2357
2358CMD:setweather(playerid, params[])
2359{
2360 LoginCheck(playerid);
2361 LevelCheck(playerid, 1);
2362
2363 new string[128], id, weather;
2364
2365 if(sscanf(params, "ui", id, weather))
2366 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setweather [playerid] [0/45]");
2367
2368 if(id == INVALID_PLAYER_ID)
2369 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2370
2371 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2372 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2373 if(weather < 0 || weather > 45) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weather ID. (0/45)");
2374 SetPlayerWeather(id, weather);
2375 format(string, sizeof(string), "You have set %s's weather to weatherID %d", pName(id), weather);
2376 SendClientMessage(playerid, COLOR_YELLOW, string);
2377 format(string, sizeof(string), "Admin %s has your weather to weatherID %d", pName(playerid), weather);
2378 SendClientMessage(id, COLOR_YELLOW, string);
2379 return 1;
2380}
2381
2382CMD:settime(playerid, params[])
2383{
2384 LoginCheck(playerid);
2385 LevelCheck(playerid, 1);
2386
2387 new string[128], id, time;
2388
2389 if(sscanf(params, "ui", id, time))
2390 return SendClientMessage(playerid, COLOR_RED, "USAGE: /settime [playerid] [0/23]");
2391
2392 if(id == INVALID_PLAYER_ID)
2393 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2394
2395 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2396 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2397
2398 if(time < 0 || time > 23) return SendClientMessage(playerid, COLOR_RED, "* Invalid Time. (0/23)");
2399 SetPlayerTime(id, time, 0);
2400 format(string, sizeof(string), "You have set %s's screen time to %d:00", pName(id), time);
2401 SendClientMessage(id, COLOR_YELLOW, string);
2402 format(string, sizeof(string), "Admin %s has set your screen time to %d:00", pName(playerid), time);
2403 SendClientMessage(id, COLOR_YELLOW, string);
2404 return 1;
2405}
2406
2407CMD:announce(playerid, params[])
2408{
2409 LoginCheck(playerid);
2410 LevelCheck(playerid, 1);
2411 if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /announce [message to all]");
2412 GameTextForAll(params, 4000, 3);
2413 return 1;
2414}
2415
2416CMD:kick(playerid, params[])
2417{
2418 LoginCheck(playerid);
2419 LevelCheck(playerid, 1);
2420
2421 new string[128], id, reason[128];
2422
2423 if(sscanf(params, "uS(Not specified)[128]", id, reason))
2424 return SendClientMessage(playerid, COLOR_RED, "USAGE: /kick [playerid] [reason(Default: N/A)]");
2425
2426 if(id == INVALID_PLAYER_ID)
2427 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2428
2429 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2430 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2431
2432 format(string, sizeof(string), "ADMIN: %s has been kicked from the server by %s (Reason: %s)", pName(id), pName(playerid), reason);
2433 SendClientMessageToAll(COLOR_ADMIN, string);
2434 print(string);
2435 SaveLog("kicklog.txt", string);
2436
2437 KickDelay(id);
2438 return 1;
2439}
2440
2441CMD:asay(playerid, params[])
2442{
2443 LoginCheck(playerid);
2444 LevelCheck(playerid, 1);
2445
2446 new string[128];
2447
2448 if(isnull(params))
2449 return SendClientMessage(playerid, COLOR_RED, "USAGE: /asay [message as asay]");
2450
2451 format(string, sizeof(string), "** Admin %s: %s", pName(playerid), params);
2452 SendClientMessageToAll(COLOR_ADMIN, string);
2453 return 1;
2454}
2455
2456//============================================================================//
2457// Administrative Level Two //
2458//============================================================================//
2459
2460CMD:caged(playerid, params[])
2461{
2462 new string[92], count = 0;
2463
2464 SendClientMessage(playerid, -1, "** "green"Caged Players "white"**");
2465 foreach(new i : Player)
2466 {
2467 if(User[i][accountCage])
2468 {
2469 format(string, sizeof(string), "(%d) %s", i, pName(i));
2470 SendClientMessage(playerid, -1, string);
2471 count++;
2472 }
2473 }
2474
2475 if(!count)
2476 SendClientMessage(playerid, -1, "No caged players at the moment.");
2477 return 1;
2478}
2479
2480CMD:cage(playerid, params[])
2481{
2482 LoginCheck(playerid);
2483 LevelCheck(playerid, 2);
2484
2485 new id, string[92];
2486
2487 if(sscanf(params, "u", id))
2488 return SendClientMessage(playerid, COLOR_RED, "USAGE: /cage [playerid]");
2489
2490 if(id == INVALID_PLAYER_ID)
2491 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2492
2493 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2494 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2495
2496 if(User[id][accountCage])
2497 return SendClientMessage(playerid, COLOR_RED, "* Player is already caged!");
2498
2499 TogglePlayerControllable(id, false);
2500 SetTimerEx("CageNikka", 1000, false, "d", id);
2501
2502 format(string, sizeof(string), "ADMIN: %s was caged by %s.", pName(id), pName(playerid));
2503 SendClientMessageToAll(COLOR_ADMIN, string);
2504 format(string, sizeof(string), "* You have been caged by %s.", pName(playerid));
2505 SendClientMessage(id, COLOR_RED, string);
2506 format(string, sizeof(string), "* You caged %s.", pName(id));
2507 SendClientMessage(playerid, -1, string);
2508
2509 User[id][accountCage] = 1;
2510 return 1;
2511}
2512
2513function:CageNikka(playerid)
2514{
2515 new Float:x, Float:y, Float:z;
2516 GetPlayerPos(playerid, x, y, z);
2517 User[playerid][accountCageObject] = CreatePlayerObject(playerid, 18856, x, y, z, 0.0, 0.0, 0.0);
2518 TogglePlayerControllable(playerid, true);
2519}
2520
2521CMD:uncage(playerid, params[])
2522{
2523 LoginCheck(playerid);
2524 LevelCheck(playerid, 2);
2525
2526 new id, string[92];
2527
2528 if(sscanf(params, "u", id))
2529 return SendClientMessage(playerid, COLOR_RED, "USAGE: /uncage [playerid]");
2530
2531 if(id == INVALID_PLAYER_ID)
2532 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2533
2534 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2535 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2536
2537 if(!User[id][accountCage])
2538 return SendClientMessage(playerid, COLOR_RED, "* Player is not caged!");
2539
2540 DestroyPlayerObject(id, User[id][accountCageObject]);
2541
2542 format(string, sizeof(string), "ADMIN: %s was uncaged by %s.", pName(id), pName(playerid));
2543 SendClientMessageToAll(COLOR_ADMIN, string);
2544 format(string, sizeof(string), "* You have been uncaged by %s.", pName(playerid));
2545 SendClientMessage(id, COLOR_GREEN, string);
2546 format(string, sizeof(string), "* You uncaged %s.", pName(id));
2547 SendClientMessage(playerid, -1, string);
2548
2549 User[id][accountCage] = 0;
2550 SaveData(id);
2551 return 1;
2552}
2553
2554CMD:checkbreach(playerid, params[])
2555{
2556 LoginCheck(playerid);
2557 LevelCheck(playerid, 2);
2558
2559 new query[128], accountname[24], DBResult:result, ip[20], date[12], type, time[12];
2560
2561 if(sscanf(params, "s[24]", accountname))
2562 return SendClientMessage(playerid, COLOR_RED, "USAGE: /checkbreach [account name]");
2563
2564 format(query, sizeof(query), "SELECT * FROM `breach` WHERE `username` = '%s' ORDER BY `ip` DESC LIMIT 10", DB_Escape(accountname));
2565 result = db_query(Database, query);
2566 if(db_num_rows(result))
2567 {
2568 SendClientMessage(playerid, COLOR_GREEN, "••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
2569 format(query, sizeof(query), "Last (10) IPs who attempted to breach into %s's account.", accountname);
2570 SendClientMessage(playerid, -1, query);
2571
2572 for (new i = 0; i < db_num_rows(result); i ++)
2573 {
2574 db_get_field_assoc(result, "ip", ip, sizeof(ip));
2575 type = db_get_field_assoc_int(result, "type");
2576 db_get_field_assoc(result, "date", date, sizeof(date));
2577 db_get_field_assoc(result, "time", time, sizeof(time));
2578
2579 format(query, sizeof(query), "IP: %s on %s %s. (Attempted to login using: %s)", ip, date, time, (type) ? ("Password") : ("Security Question"));
2580 SendClientMessage(playerid, COLOR_YELLOW, query);
2581 db_next_row(result);
2582 }
2583
2584 SendClientMessage(playerid, COLOR_GREEN, "••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
2585 }
2586 else
2587 {
2588 format(query, sizeof(query), "* '%s' isn't found in the database." ,accountname);
2589 SendClientMessage(playerid, COLOR_RED, query);
2590 }
2591 db_free_result(result);
2592 return 1;
2593}
2594
2595CMD:ips(playerid, params[])
2596{
2597 LoginCheck(playerid);
2598 LevelCheck(playerid, 2);
2599
2600 new query[128], accountname[24], DBResult:result, ip[20], date[12], time[12];
2601
2602 if(sscanf(params, "s[24]", accountname))
2603 return SendClientMessage(playerid, COLOR_RED, "USAGE: /ips [account name]");
2604
2605 format(query, sizeof(query), "SELECT * FROM `ips` WHERE `username` = '%s' ORDER BY `ip` DESC LIMIT 10", DB_Escape(accountname));
2606 result = db_query(Database, query);
2607 if(db_num_rows(result))
2608 {
2609 SendClientMessage(playerid, COLOR_GREEN, "••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
2610 format(query, sizeof(query), "%s's last (10) IP used in the server.", accountname);
2611 SendClientMessage(playerid, -1, query);
2612
2613 for (new i = 0; i < db_num_rows(result); i ++)
2614 {
2615 db_get_field_assoc(result, "ip", ip, sizeof(ip));
2616 db_get_field_assoc(result, "date", date, sizeof(date));
2617 db_get_field_assoc(result, "time", time, sizeof(time));
2618
2619 format(query, sizeof(query), "Player connected with the IP %s on %s %s.", ip, date, time);
2620 SendClientMessage(playerid, COLOR_YELLOW, query);
2621 db_next_row(result);
2622 }
2623
2624 SendClientMessage(playerid, COLOR_GREEN, "••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••");
2625 }
2626 else
2627 {
2628 format(query, sizeof(query), "* '%s' isn't found in the database." ,accountname);
2629 SendClientMessage(playerid, COLOR_RED, query);
2630 }
2631 db_free_result(result);
2632 return 1;
2633}
2634
2635CMD:respawncar(playerid, params[])
2636{
2637 LoginCheck(playerid);
2638 LevelCheck(playerid, 2);
2639
2640 new string[92], carid;
2641
2642 if(sscanf(params, "d", carid))
2643 return SendClientMessage(playerid, COLOR_RED, "USAGE: /respawncar [vehicleid]");
2644
2645 if(carid < 1 || !IsValidVehicle(carid) || carid > MAX_VEHICLES)
2646 return SendClientMessage(playerid, COLOR_RED, "* Invalid vehicleID.");
2647
2648 SetVehicleToRespawn(carid);
2649 format(string, sizeof(string), "You have respawned vehicle ID %d.", carid);
2650 SendClientMessage(playerid, -1, string);
2651 return 1;
2652}
2653
2654CMD:radiusrespawn(playerid, params[])
2655{
2656 LoginCheck(playerid);
2657 LevelCheck(playerid, 2);
2658
2659 new string[92], Float:range, numcars;
2660 new Float:x, Float:y, Float:z;
2661 GetPlayerPos(playerid, x, y, z);
2662
2663 if(sscanf(params, "f", range))
2664 return SendClientMessage(playerid, COLOR_RED, "USAGE: /radiusrespawn [range]");
2665
2666 for(new i = 1; i < MAX_VEHICLES; i++)
2667 {
2668 if(IsValidVehicle(i) && GetVehicleDistanceFromPoint(i, x, y, z) <= range && !VehicleOccupied(i))
2669 {
2670 SetVehicleToRespawn(i);
2671 numcars++;
2672 }
2673 }
2674
2675 if(!numcars)
2676 return SendClientMessage(playerid, COLOR_RED, "No cars respawned.");
2677
2678 format(string, sizeof(string), "** Admin %s has made a car respawn on their radius %dm", pName(playerid), floatround(range));
2679 SendClientMessageToAll(COLOR_ADMIN, string);
2680 format(string, sizeof(string), "You have respawned %d cars within %d meters.", numcars, floatround(range));
2681 SendClientMessage(playerid, -1, string);
2682 return 1;
2683}
2684CMD:rr(playerid, params[]) return cmd_radiusrespawn(playerid, params);
2685
2686CMD:addlabel(playerid, params[])
2687{
2688 LoginCheck(playerid);
2689 LevelCheck(playerid, 2);
2690
2691 new id = -1, string[128], color, text[128], distance, seethrough;
2692
2693 if(sscanf(params, "ddds[128]", color, distance, seethrough, text))
2694 {
2695 SendClientMessage(playerid, COLOR_RED, "USAGE: /addlabel [colorID] [distance(10>50)] [seethrough(0-ON/1-OFF)] [text]");
2696 SendClientMessage(playerid, -1, "Available ColorIDs: 1 - White, 2 - {FF0000}Red{FFFFFF}, 3 - {FFFF00}Yellow{FFFFFF}, 4 - {33AA33}Green{FFFFFF}, 5 - {FF8000}Orange{FFFFFF},");
2697 SendClientMessage(playerid, -1, "Available ColorIDs: 6 - {D526D9}Purple{FFFFFF}, 7 - {FF80FF}Pink{FFFFFF}, 8 - {33CCFF}Lightblue{FFFFFF},");
2698 SendClientMessage(playerid, -1, "Available ColorIDs: 9 - {0080FF}Blue{FFFFFF}, 10 - {00FF00}Lightgreen");
2699 return 1;
2700 }
2701
2702 if(distance < 10 || distance > 50)
2703 return SendClientMessage(playerid, COLOR_RED, "* Invalid distance.");
2704
2705 if(seethrough < 0 || seethrough > 1)
2706 return SendClientMessage(playerid, COLOR_RED, "* Invalid see-through value.");
2707
2708 switch(color)
2709 {
2710 case 1: // White
2711 {
2712 id = Deploy_Label(playerid, 0xFFFFFFFF, text, distance, seethrough);
2713 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2714 format(string, sizeof(string), "* You have deployed label ID %d, color white (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2715 SendClientMessage(playerid, -1, string);
2716 }
2717 case 2: // Red
2718 {
2719 id = Deploy_Label(playerid, 0xFF0000FF, text, distance, seethrough);
2720 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2721 format(string, sizeof(string), "* You have deployed label ID %d, color red (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2722 SendClientMessage(playerid, COLOR_RED, string);
2723 }
2724 case 3: // Yellow
2725 {
2726 id = Deploy_Label(playerid, 0xFFFF00FF, text, distance, seethrough);
2727 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2728 format(string, sizeof(string), "* You have deployed label ID %d, color yellow (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2729 SendClientMessage(playerid, COLOR_YELLOW, string);
2730 }
2731 case 4: // Green
2732 {
2733 id = Deploy_Label(playerid, 0x33AA33FF, text, distance, seethrough);
2734 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2735 format(string, sizeof(string), "* You have deployed label ID %d, color yellow (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2736 SendClientMessage(playerid, COLOR_GREEN, string);
2737 }
2738 case 5: // Orange
2739 {
2740 id = Deploy_Label(playerid, 0xFF8000FF, text, distance, seethrough);
2741 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2742 format(string, sizeof(string), "* You have deployed label ID %d, color orange (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2743 SendClientMessage(playerid, COLOR_ORANGE, string);
2744 }
2745 case 6: // Purple
2746 {
2747 id = Deploy_Label(playerid, 0xD526D9FF, text, distance, seethrough);
2748 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2749 format(string, sizeof(string), "* You have deployed label ID %d, color purple (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2750 SendClientMessage(playerid, COLOR_PURPLE, string);
2751 }
2752 case 7: // Pink
2753 {
2754 id = Deploy_Label(playerid, 0xFF80FFFF, text, distance, seethrough);
2755 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2756 format(string, sizeof(string), "* You have deployed label ID %d, color pink (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2757 SendClientMessage(playerid, COLOR_PINK, string);
2758 }
2759 case 8: // Lightblue
2760 {
2761 id = Deploy_Label(playerid, 0x33CCFFFF, text, distance, seethrough);
2762 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2763 format(string, sizeof(string), "* You have deployed label ID %d, color lightblue (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2764 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
2765 }
2766 case 9: // Blue
2767 {
2768 id = Deploy_Label(playerid, 0x0080FFFF, text, distance, seethrough);
2769 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2770 format(string, sizeof(string), "* You have deployed label ID %d, color blue (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2771 SendClientMessage(playerid, COLOR_BLUE, string);
2772 }
2773 case 10: // Lightgreen
2774 {
2775 id = Deploy_Label(playerid, 0x00FF00FF, text, distance, seethrough);
2776 if(id == -1) return SendClientMessage(playerid, COLOR_RED, "* Unable to deploy more labels, possibly reached the ("#MAX_DEPLOYABLE_LABEL") limit.");
2777 format(string, sizeof(string), "* You have deployed label ID %d, color lightgreen (distance: %d | seethrough: %d)", id + 1, distance, seethrough);
2778 SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
2779 }
2780 default: SendClientMessage(playerid, COLOR_RED, "* Invalid colorID specified.");
2781 }
2782 return 1;
2783}
2784
2785CMD:gotolabel(playerid, params[])
2786{
2787 LoginCheck(playerid);
2788 LevelCheck(playerid, 2);
2789
2790 new id, string[92];
2791
2792 if(sscanf(params, "d", id))
2793 return SendClientMessage(playerid, COLOR_RED, "USAGE: /gotolabel [labelID]");
2794
2795 if(id < 1 || !lInfo[id-1][labelTaken] || id > MAX_DEPLOYABLE_LABEL+1)
2796 return SendClientMessage(playerid, COLOR_RED, "* Invalid labelID specified.");
2797
2798 format(string, sizeof(string), "* You have teleported to label ID %d.", id);
2799 SendClientMessage(playerid, -1, string);
2800
2801 SetPlayerInterior(playerid, lInfo[id-1][labelInterior]);
2802 SetPlayerVirtualWorld(playerid, lInfo[id-1][labelVW]);
2803 SetPlayerPos(playerid, lInfo[id-1][labelX], lInfo[id-1][labelY], lInfo[id-1][labelZ]);
2804 return 1;
2805}
2806
2807CMD:destroylabel(playerid, params[])
2808{
2809 LoginCheck(playerid);
2810 LevelCheck(playerid, 2);
2811
2812 new id, string[92];
2813
2814 if(sscanf(params, "d", id))
2815 return SendClientMessage(playerid, COLOR_RED, "USAGE: /destroylabel [labelID]");
2816
2817 if(id < 1 || !lInfo[id-1][labelTaken] || id > MAX_DEPLOYABLE_LABEL+1)
2818 return SendClientMessage(playerid, COLOR_RED, "* Invalid labelID specified.");
2819
2820 format(string, sizeof(string), "* You have destroyed label ID %d.", id);
2821 SendClientMessage(playerid, -1, string);
2822 lInfo[id-1][labelX] = 0;
2823 lInfo[id-1][labelY] = 0;
2824 lInfo[id-1][labelZ] = 0;
2825 lInfo[id-1][labelTaken] = false;
2826 DestroyDynamic3DTextLabel(lInfo[id-1][label3D]);
2827 return 1;
2828}
2829
2830CMD:jetpack(playerid, params[])
2831{
2832 LoginCheck(playerid);
2833 LevelCheck(playerid, 2);
2834
2835 new id, string[92];
2836
2837 if(!sscanf(params, "u", id))
2838 {
2839 if(id == INVALID_PLAYER_ID)
2840 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2841
2842 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2843 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2844
2845 SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
2846
2847 if(id != playerid)
2848 {
2849 format(string, sizeof(string), "[Jetpack] %s has given %s a jetpack.", pName(playerid), pName(id));
2850 SendAdmin(COLOR_ADMIN, string);
2851 format(string, sizeof(string), "You have given Player %s(ID:%d) a jetpack.", pName(id), id);
2852 SendClientMessage(playerid, COLOR_YELLOW, string);
2853 format(string, sizeof(string), "Admin %s(ID:%d) has given you a jetpack.", pName(playerid), playerid);
2854 SendClientMessage(id, COLOR_YELLOW, string);
2855 }
2856 else
2857 {
2858 format(string, sizeof(string), "[Jetpack] %s has given themself a jetpack.", pName(playerid));
2859 SendAdmin(COLOR_ADMIN, string);
2860 SendClientMessage(playerid, COLOR_YELLOW, "Jetpack Spawned!");
2861 }
2862 }
2863 else
2864 {
2865 format(string, sizeof(string), "[Jetpack] %s has given themself a jetpack.", pName(playerid));
2866 SendAdmin(COLOR_ADMIN, string);
2867
2868 SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
2869 SendClientMessage(playerid, COLOR_YELLOW, "Jetpack Spawned!");
2870 SendClientMessage(playerid, -1, "Want to give player a jetpack? Just do "green"/jetpack [playerid]");
2871 }
2872 return 1;
2873}
2874
2875CMD:aweapons(playerid, params[])
2876{
2877 LoginCheck(playerid);
2878 LevelCheck(playerid, 2);
2879
2880 GivePlayerWeapon(playerid, 24, 99999);
2881 GivePlayerWeapon(playerid, 26, 99999);
2882 GivePlayerWeapon(playerid, 29, 99999);
2883 GivePlayerWeapon(playerid, 31, 99999);
2884 GivePlayerWeapon(playerid, 33, 99999);
2885 GivePlayerWeapon(playerid, 38, 99999);
2886 GivePlayerWeapon(playerid, 9, 1);
2887
2888 SendClientMessage(playerid, COLOR_YELLOW, "Admin weapons received!");
2889 return 1;
2890}
2891
2892CMD:muted(playerid, params[])
2893{
2894 new string[92], count = 0;
2895
2896 SendClientMessage(playerid, -1, "** "green"Muted Players "white"**");
2897
2898 foreach(new i : Player)
2899 {
2900 if(User[i][accountMuted])
2901 {
2902 if(User[i][accountMuteSec] > 0)
2903 format(string, sizeof(string), "(%d) %s - (%d)", i, pName(i), User[i][accountMuteSec]);
2904 else if(User[i][accountMuteSec] == -1)
2905 format(string, sizeof(string), "(%d) %s - (Permanent)", i, pName(i));
2906
2907 SendClientMessage(playerid, -1, string);
2908 count++;
2909 }
2910 }
2911
2912 if(!count)
2913 SendClientMessage(playerid, -1, "No muted players at the moment.");
2914 return 1;
2915}
2916
2917CMD:jailed(playerid, params[])
2918{
2919 new string[92], count = 0;
2920
2921 SendClientMessage(playerid, -1, "** "green"Jailed Players "white"**");
2922
2923 foreach(new i : Player)
2924 {
2925 if(User[i][accountJail])
2926 {
2927 format(string, sizeof(string), "(%d) %s - (%d)", i, pName(i), User[i][accountJailSec]);
2928 SendClientMessage(playerid, -1, string);
2929 count++;
2930 }
2931 }
2932
2933 if(!count)
2934 SendClientMessage(playerid, -1, "No jailed players at the moment.");
2935 return 1;
2936}
2937
2938CMD:setvhealth(playerid, params[])
2939{
2940 LoginCheck(playerid);
2941 LevelCheck(playerid, 2);
2942
2943 new
2944 string[128],
2945 id,
2946 hp
2947 ;
2948
2949 if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvhealth [playerid] [health]");
2950 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2951 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2952 new Float:hp2 = float(hp);
2953
2954 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle!");
2955 SetVehicleHealth(GetPlayerVehicleID(id), hp2);
2956
2957 format(string, sizeof(string), "You have set %s's vehicle health to %d", pName(id), floatround(hp2));
2958 SendClientMessage(playerid, COLOR_YELLOW, string);
2959 format(string, sizeof(string), "Admin %s has set your vehicle health to %d", pName(playerid), floatround(hp2));
2960 SendClientMessage(id, COLOR_YELLOW, string);
2961 return 1;
2962}
2963
2964CMD:eject(playerid, params[])
2965{
2966 LoginCheck(playerid);
2967 LevelCheck(playerid, 2);
2968
2969 new string[128], id;
2970
2971 if(sscanf(params, "u", id))
2972 return SendClientMessage(playerid, COLOR_RED, "USAGE: /eject [playerid]");
2973
2974 if(id == INVALID_PLAYER_ID)
2975 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2976
2977 if(User[playerid][accountAdmin] < User[id][accountAdmin])
2978 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2979
2980 if(!IsPlayerInAnyVehicle(id))
2981 return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of the vehicle.");
2982
2983 RemovePlayerFromVehicle(id);
2984 format(string, sizeof(string), "You have ejected %s from their vehicle", pName(id));
2985 SendClientMessage(playerid, COLOR_YELLOW, string);
2986 format(string, sizeof(string), "Admin %s has ejected you from your vehicle.", pName(playerid));
2987 SendClientMessage(id, COLOR_YELLOW, string);
2988 return 1;
2989}
2990
2991CMD:carpjob(playerid, params[])
2992{
2993 LoginCheck(playerid);
2994 LevelCheck(playerid, 2);
2995
2996 new
2997 string[128],
2998 id,
2999 pjob
3000 ;
3001 if(sscanf(params, "ui", id, pjob))
3002 return SendClientMessage(playerid, COLOR_RED, "* /carpjob [playerid] [paintjob(0-3)]");
3003
3004 if(id == INVALID_PLAYER_ID)
3005 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3006
3007 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3008 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3009
3010 if(!IsPlayerInAnyVehicle(id))
3011 return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle.");
3012
3013 if(pjob < 0 || pjob > 3)
3014 return SendClientMessage(playerid, COLOR_RED, "* Invalid Paintjob ID.");
3015
3016 format(string, sizeof(string), "You have changed the paintjob of %s's %s to '%d'", pName(id), VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
3017 SendClientMessage(playerid, COLOR_GREEN, string);
3018 format(string, sizeof(string), "Admin %s has changed the paintjob of your %s to '%d'", pName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
3019 SendClientMessage(id, COLOR_YELLOW, string);
3020 ChangeVehiclePaintjob(GetPlayerVehicleID(id), pjob);
3021 return 1;
3022}
3023
3024CMD:carcolor(playerid, params[])
3025{
3026 LoginCheck(playerid);
3027 LevelCheck(playerid, 2);
3028
3029 new
3030 string[128],
3031 id,
3032 col1,
3033 col2
3034 ;
3035 if(sscanf(params, "uiI(255)", id, col1, col2))
3036 return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor [playerid] [colour1] [colour2(optional)]");
3037
3038 if(id == INVALID_PLAYER_ID)
3039 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3040
3041 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3042 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3043
3044 if(!IsPlayerInAnyVehicle(id))
3045 return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle.");
3046
3047 if(col2==255) col2=random(256);
3048
3049 format(string, sizeof(string), "You have changed the color of %s's %s to '%d,%d'", pName(id), VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
3050 SendClientMessage(playerid, COLOR_GREEN, string);
3051 format(string, sizeof(string), "Admin %s has changed the color of your %s to '%d,%d'", pName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
3052 SendClientMessage(id, COLOR_YELLOW, string);
3053 ChangeVehicleColor(GetPlayerVehicleID(id), col1, col2);
3054 return 1;
3055}
3056
3057CMD:cc(playerid, params[]) return cmd_carcolor(playerid, params);
3058
3059CMD:givecar(playerid, params[])
3060{
3061 LoginCheck(playerid);
3062 LevelCheck(playerid, 2);
3063
3064 new string[128],
3065 vID[32],
3066 id,
3067 vVW,
3068 vINT,
3069 vid,
3070 Float:x,
3071 Float:y,
3072 Float:z,
3073 Float:ang,
3074 vehicle,
3075 col1,
3076 col2
3077 ;
3078 if(sscanf(params, "us[32]I(255)I(255)", id, vID, col1, col2))
3079 return SendClientMessage(playerid, COLOR_RED, "USAGE: /givecar [playerid] [vehicleid(or name)] [color1(optional)] [color2(optional)]");
3080
3081 if(id == INVALID_PLAYER_ID)
3082 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3083
3084 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3085 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3086
3087 if(isnumeric(vID)) vid = strval(vID);
3088 else vid = GetVehicleModelIDFromName(vID);
3089 GetPlayerPos(id, x, y, z);
3090 GetPlayerFacingAngle(id, ang);
3091
3092 if(vid < 400 || vid > 611)
3093 return SendClientMessage(playerid, COLOR_RED, "* Invalid Vehicle Model ID!");
3094
3095 if(IsPlayerInAnyVehicle(id))
3096 return SendClientMessage(playerid, COLOR_RED, "* Player already have a vehicle.");
3097
3098 if(col1==255) col1=random(256);
3099 if(col2==255) col2=random(256);
3100
3101 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(id))
3102 EraseVeh(User[id][pCar]);
3103
3104 vehicle = CreateVehicle(vid, x, y, z, 0, -1, -1, 0);
3105 vVW = GetPlayerVirtualWorld(id);
3106 vINT = GetPlayerInterior(id);
3107 SetVehicleVirtualWorld(vehicle, vVW);
3108 LinkVehicleToInterior(vehicle, vINT);
3109 PutPlayerInVehicle(id, vehicle, 0);
3110 User[id][pCar] = vehicle;
3111 format(string, sizeof(string), "Admin %s(%d) has given you a %s(%i)", pName(playerid), playerid, VehicleNames[vid - 400], vid);
3112 SendClientMessage(id, COLOR_YELLOW, string);
3113 format(string, sizeof(string), "You have given %s(%d) a %s(%i)", pName(id), id, VehicleNames[vid - 400], vid);
3114 SendClientMessage(playerid, COLOR_YELLOW, string);
3115 return 1;
3116}
3117
3118CMD:car(playerid, params[])
3119{
3120 LoginCheck(playerid);
3121 LevelCheck(playerid, 2);
3122
3123 new carID[50], car, colour1, colour2, string[128];
3124 if(sscanf(params, "s[50]I(255)I(255)", carID, colour1, colour2))
3125 return SendClientMessage(playerid, COLOR_RED, "USAGE: /car [VehicleID(Name)] [Color1(Optional)] [Color2(Optional)]");
3126
3127 if(!isnumeric(carID)) car = GetVehicleModelIDFromName(carID);
3128 else car = strval(carID);
3129
3130 if(car < 400 || car > 611)
3131 return SendClientMessage(playerid, COLOR_RED, "* Invalid Vehicle Model ID!");
3132
3133 if(colour1==255) colour1=random(256);
3134 if(colour2==255) colour2=random(256);
3135
3136 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(playerid))
3137 EraseVeh(User[playerid][pCar]);
3138 new VehicleID;
3139 new Float:X, Float:Y, Float:Z;
3140 new Float:Angle, int1;
3141 GetPlayerPos(playerid, X, Y, Z);
3142 GetPlayerFacingAngle(playerid, Angle);
3143 int1 = GetPlayerInterior(playerid);
3144 VehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
3145 LinkVehicleToInterior(VehicleID, int1);
3146 SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
3147 User[playerid][pCar] = VehicleID;
3148 format(string, sizeof(string), "You have spawned a %s (Model: %d) with color %d,%d", VehicleNames[car-400], car, colour1, colour2);
3149 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
3150 return 1;
3151}
3152
3153CMD:spec(playerid, params[])
3154{
3155 LoginCheck(playerid);
3156 LevelCheck(playerid, 2);
3157
3158 new string[128], specplayerid, option[32];
3159
3160 if(sscanf(params, "s[32]", option))
3161 return SendClientMessage(playerid, COLOR_RED, "USAGE: /spec [playerid(OFF)]");
3162
3163 if(!strcmp(option, "off", true))
3164 {
3165 if(User[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
3166 {
3167 StopSpectate(playerid);
3168 SetTimerEx("PosAfterSpec", 1000, 0, "d", playerid);
3169 SendClientMessage(playerid, COLOR_LIGHTBLUE, "No longer spectating.");
3170 }
3171 else return SendClientMessage(playerid, COLOR_RED, "* You are not spectating anyone.");
3172 return 1;
3173 }
3174
3175 specplayerid = ReturnUser(option);
3176
3177 if(!IsPlayerConnected(specplayerid))
3178 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3179
3180 if(User[playerid][accountAdmin] < User[specplayerid][accountAdmin])
3181 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3182
3183 if(specplayerid == playerid)
3184 return SendClientMessage(playerid, COLOR_RED, "* You cannot spectate yourself.");
3185
3186 if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING)
3187 return SendClientMessage(playerid, COLOR_RED, "* Player is spectating someone.");
3188
3189 if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3)
3190 return SendClientMessage(playerid, COLOR_RED, "* Player not spawned.");
3191
3192 GetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
3193 GetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
3194 SpecInt[playerid][0] = GetPlayerInterior(playerid);
3195 SpecInt[playerid][1] = GetPlayerVirtualWorld(playerid);
3196 StartSpectate(playerid, specplayerid);
3197 format(string, sizeof(string), "Now Spectating: %s (ID: %d)", pName(specplayerid), specplayerid);
3198 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
3199 SendClientMessage(playerid, -1, "Press SHIFT for Advance Spectating and SPACE for backward spectating.");
3200 return 1;
3201}
3202
3203CMD:specoff(playerid, params[])
3204 return SendClientMessage(playerid, -1, "Command has been separated and combined to /spec (/spec off)");
3205
3206CMD:akill(playerid, params[])
3207{
3208 LoginCheck(playerid);
3209 LevelCheck(playerid, 2);
3210
3211 new string[128], reason[128], id;
3212
3213 if(sscanf(params, "uS(No Reason)[128]", id, reason))
3214 return SendClientMessage(playerid, COLOR_RED, "USAGE: /akill [playerid] [reason(Default: None)]");
3215
3216 if(id == INVALID_PLAYER_ID)
3217 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3218
3219 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3220 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3221
3222 if(User[id][accountGod] == 1)
3223 {
3224 User[id][accountGod] = 0;
3225 }
3226
3227 SetPlayerHealth(id, 0.0);
3228 format(string, sizeof(string), "ADMIN: %s was killed by %s (Reason: %s)", pName(id), pName(playerid), reason);
3229 SendClientMessageToAll(COLOR_ADMIN, string);
3230 return 1;
3231}
3232
3233CMD:jail(playerid, params[])
3234{
3235 LoginCheck(playerid);
3236 LevelCheck(playerid, 2);
3237
3238 new id, sec, reason[128], string[128];
3239
3240 if(sscanf(params, "uiS(None)[128]", id, sec, reason))
3241 return SendClientMessage(playerid, COLOR_RED, "USAGE: /jail [playerid] [seconds] [reason]");
3242
3243 if(id == INVALID_PLAYER_ID)
3244 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3245
3246 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3247 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3248
3249 if(sec < 30)
3250 return SendClientMessage(playerid, COLOR_RED, "* You cannot jail lower than 30 seconds.");
3251
3252 if(User[id][accountJail])
3253 return SendClientMessage(playerid, COLOR_RED, "* Player already jailed.");
3254
3255 if(id == playerid)
3256 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3257
3258 SetCameraBehindPlayer(id);
3259 SetPlayerPos(id, 197.6661, 173.8179, 1003.0234);
3260 SetPlayerInterior(id, 3);
3261
3262 format(string, sizeof(string), "ADMIN: %s was jailed for %d seconds by %s (Reason: %s)", pName(id), sec, pName(playerid), reason);
3263 SendClientMessageToAll(COLOR_ADMIN, string);
3264 format(string, sizeof(string), "You have been jailed by %s for %d seconds [%s].", pName(playerid), sec, reason);
3265 SendClientMessage(id, -1, string);
3266
3267 format(string, sizeof(string), "%s has been jailed by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
3268 SaveLog("jail.txt", string);
3269
3270 User[id][accountJail] = 1;
3271 User[id][accountJailSec] = sec;
3272 return 1;
3273}
3274
3275CMD:unjail(playerid, params[])
3276{
3277 LoginCheck(playerid);
3278 LevelCheck(playerid, 2);
3279
3280 new id, reason[128], string[128];
3281
3282 if(sscanf(params, "uS(None)[128]", id, reason))
3283 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unjail [playerid] [reason]");
3284
3285 if(id == INVALID_PLAYER_ID)
3286 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3287
3288 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3289 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3290
3291 if(!User[id][accountJail])
3292 return SendClientMessage(playerid, COLOR_RED, "* Player not in jailed.");
3293
3294 if(id == playerid)
3295 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3296
3297 format(string, sizeof(string), "ADMIN: %s was released from the jail by %s for %s", pName(id), pName(playerid), reason);
3298 SendClientMessageToAll(COLOR_ADMIN, string);
3299 format(string, sizeof(string), "You have been released from jail by %s.", pName(playerid));
3300 SendClientMessage(id, COLOR_GREEN, string);
3301
3302 format(string, sizeof(string), "%s has been unjailed by %s for %s", pName(id), pName(playerid), reason);
3303 SaveLog("jail.txt", string);
3304
3305 User[id][accountJail] = 0;
3306 User[id][accountJailSec] = 0;
3307 SpawnPlayer(id);
3308 return 1;
3309}
3310
3311CMD:mute(playerid, params[])
3312{
3313 LoginCheck(playerid);
3314 LevelCheck(playerid, 2);
3315
3316 new id, sec, reason[128], string[128];
3317
3318 if(sscanf(params, "uD(-1)S(None)[128]", id, sec, reason))
3319 return SendClientMessage(playerid, COLOR_RED, "USAGE: /mute [playerid] [seconds(optional for permanent)] [reason(optional)]");
3320
3321 if(id == INVALID_PLAYER_ID)
3322 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3323
3324 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3325 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3326
3327 if(sec < 30 && sec != -1)
3328 return SendClientMessage(playerid, COLOR_RED, "* You cannot mute lower than 30 seconds.");
3329
3330 if(User[id][accountMuted])
3331 return SendClientMessage(playerid,COLOR_RED, "* Player already muted.");
3332
3333 if(id == playerid)
3334 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3335
3336 if(sec != -1)
3337 {
3338 format(string, sizeof(string), "ADMIN: %s was muted for %d seconds by %s (Reason: %s)", pName(id), sec, pName(playerid), reason);
3339 SendClientMessageToAll(COLOR_ADMIN, string);
3340 format(string, sizeof(string), "You have been muted by %s for %d seconds [%s].", pName(playerid), sec, reason);
3341 SendClientMessage(id, -1, string);
3342
3343 format(string, sizeof(string), "%s has been muted by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
3344 SaveLog("mute.txt", string);
3345 }
3346 else
3347 {
3348 format(string, sizeof(string), "ADMIN: %s was muted permanently by %s (Reason: %s)", pName(id), pName(playerid), reason);
3349 SendClientMessageToAll(COLOR_ADMIN, string);
3350 format(string, sizeof(string), "You have been muted permanently by %s. [%s].", pName(playerid), reason);
3351 SendClientMessage(id, -1, string);
3352
3353 format(string, sizeof(string), "%s has been muted by %s (reason %s)", pName(id), pName(playerid), reason);
3354 SaveLog("mute.txt", string);
3355 }
3356
3357 User[id][accountMuted] = 1;
3358 User[id][accountMuteSec] = sec;
3359 return 1;
3360}
3361
3362CMD:unmute(playerid, params[])
3363{
3364 LoginCheck(playerid);
3365 LevelCheck(playerid, 2);
3366
3367 new id, reason[128], string[128];
3368
3369 if(sscanf(params, "uS(None)[128]", id, reason))
3370 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unmute [playerid] [reason]");
3371
3372 if(id == INVALID_PLAYER_ID)
3373 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3374
3375 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3376 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3377
3378 if(!User[id][accountMuted])
3379 return SendClientMessage(playerid, COLOR_RED, "* Player not muted.");
3380
3381 if(id == playerid)
3382 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3383
3384 format(string, sizeof(string), "ADMIN: %s was unmuted by %s for %s", pName(id), pName(playerid), reason);
3385 SendClientMessageToAll(COLOR_ADMIN, string);
3386 format(string, sizeof(string), "You have been unmuted by %s.", pName(playerid));
3387 SendClientMessage(id, -1, string);
3388
3389 format(string, sizeof(string), "%s has been unmuted by %s", pName(id), pName(playerid));
3390 SaveLog("mute.txt", string);
3391
3392 User[id][accountMuted] = 0;
3393 User[id][accountMuteSec] = 0;
3394 return 1;
3395}
3396
3397CMD:setskin(playerid, params[])
3398{
3399 new string[128], id, skin;
3400
3401 LoginCheck(playerid);
3402 LevelCheck(playerid, 2);
3403
3404 if(sscanf(params, "ui", id, skin)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setskin [playerid] [skin(0-311)]");
3405 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3406 if(skin < 0 || skin == 74 || skin > 311) return SendClientMessage(playerid, COLOR_RED, "* Invalid skinID.");
3407
3408 format(string, sizeof(string), "You have set "green"%s's "white"skinID to "grey"%d", pName(id), skin);
3409 SendClientMessage(playerid, -1, string);
3410
3411 format(string, sizeof(string), "Admin "green"%s "white"has set your skinID to "grey"%d", pName(playerid), skin);
3412 SendClientMessage(id, -1, string);
3413
3414 SetPlayerSkin(id, skin);
3415 return 1;
3416}
3417
3418CMD:clearchat(playerid, params[])
3419{
3420 LoginCheck(playerid);
3421 LevelCheck(playerid, 2);
3422
3423 new string[128];
3424
3425 for(new i=0; i<100; i++)
3426 {
3427 SendClientMessageToAll(-1, " ");
3428 }
3429
3430 format(string, sizeof string, "Chat was cleared by %s.", pName(playerid));
3431 SendClientMessageToAll(COLOR_ADMIN, string);
3432 return 1;
3433}
3434
3435CMD:heal(playerid, params[])
3436{
3437 LoginCheck(playerid);
3438 LevelCheck(playerid, 2);
3439
3440 new id, string[92];
3441
3442 if(sscanf(params, "u", id))
3443 return SendClientMessage(playerid, COLOR_RED, "USAGE: /heal [playerid]");
3444
3445 if(id == INVALID_PLAYER_ID)
3446 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3447
3448 SetPlayerHealth(id, 100.0);
3449 format(string, sizeof(string), "You have healed %s.", pName(id));
3450 SendClientMessage(playerid, COLOR_YELLOW, string);
3451 format(string, sizeof(string), "Admin %s has healed you.", pName(playerid));
3452 SendClientMessage(id, COLOR_YELLOW, string);
3453 return 1;
3454}
3455
3456CMD:armour(playerid, params[])
3457{
3458 LoginCheck(playerid);
3459 LevelCheck(playerid, 2);
3460
3461 new id, string[128];
3462
3463 if(sscanf(params, "u", id))
3464 return SendClientMessage(playerid, COLOR_RED, "USAGE: /armour [playerid]");
3465
3466 if(id == INVALID_PLAYER_ID)
3467 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3468
3469 SetPlayerArmour(id, 100.0);
3470 format(string, sizeof(string), "You have given %s an armour.", pName(id));
3471 SendClientMessage(playerid, COLOR_YELLOW, string);
3472 format(string, sizeof(string), "Admin %s has given you a full armour.", pName(playerid));
3473 SendClientMessage(id, COLOR_YELLOW, string);
3474 return 1;
3475}
3476
3477CMD:setinterior(playerid, params[])
3478{
3479 LoginCheck(playerid);
3480 LevelCheck(playerid, 2);
3481
3482 new string[128], id, interior;
3483
3484 if(sscanf(params, "ui", id, interior))
3485 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setinterior [playerid] [interior]");
3486
3487 if(id == INVALID_PLAYER_ID)
3488 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3489
3490 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3491 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3492
3493 SetPlayerInterior(id, interior);
3494 format(string, sizeof(string), "Admin %s has set your interior to %d.", pName(playerid), interior);
3495 SendClientMessage(id, COLOR_ORANGE, string);
3496 format(string, sizeof(string), "You have set Player %s's interior to %d.", pName(id), interior);
3497 SendClientMessage(playerid, COLOR_ORANGE, string);
3498 return 1;
3499}
3500
3501CMD:setworld(playerid, params[])
3502{
3503 LoginCheck(playerid);
3504 LevelCheck(playerid, 2);
3505
3506 new
3507 string[128],
3508 id,
3509 vw
3510 ;
3511
3512 if(sscanf(params, "ui", id, vw))
3513 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setworld [playerid] [virtual world]");
3514
3515 if(id == INVALID_PLAYER_ID)
3516 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3517
3518 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3519 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3520
3521 SetPlayerVirtualWorld(id, vw);
3522 format(string, sizeof(string), "Admin %s has set your virtual world to %d.", pName(playerid), vw);
3523 SendClientMessage(id, COLOR_ORANGE, string);
3524 format(string, sizeof(string), "You have set %s's virtual world to %d.", pName(id), vw);
3525 SendClientMessage(playerid, COLOR_ORANGE, string);
3526 return 1;
3527}
3528
3529CMD:explode(playerid, params[])
3530{
3531 LoginCheck(playerid);
3532 LevelCheck(playerid, 2);
3533
3534 new string[128], id, Float:x, Float:y, Float:z, reason[128];
3535
3536 if(sscanf(params, "uS(Not specified)[128]", id, reason))
3537 return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [playerid] [reason(Default: N/A)]");
3538
3539 if(id == INVALID_PLAYER_ID)
3540 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3541
3542 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3543 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3544
3545 GetPlayerPos(id, x, y, z);
3546 format(string, sizeof(string), "ADMIN: %s has been exploded by %s (Reason: %s)", pName(id), pName(playerid), reason);
3547 SendClientMessageToAll(COLOR_ADMIN, string);
3548 SaveLog("explode.txt", string);
3549 CreateExplosionForPlayer(id, x, y, z, 7, 1.00);
3550 return 1;
3551}
3552
3553CMD:disarm(playerid, params[])
3554{
3555 LoginCheck(playerid);
3556 LevelCheck(playerid, 2);
3557
3558 new string[92], id;
3559
3560 if(sscanf(params, "u", id))
3561 return SendClientMessage(playerid, COLOR_RED, "USAGE: /disarm [playerid]");
3562
3563 if(id == INVALID_PLAYER_ID)
3564 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3565
3566 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3567 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3568
3569 ResetPlayerWeapons(id);
3570 format(string, sizeof(string), "You have removed %s's guns.", pName(id));
3571 SendClientMessage(playerid, COLOR_YELLOW, string);
3572 format(string, sizeof(string), "Admin %s has removed your guns.", pName(playerid));
3573 SendClientMessage(id, COLOR_YELLOW, string);
3574 return 1;
3575}
3576
3577//============================================================================//
3578// Administrative Level Three //
3579//============================================================================//
3580
3581CMD:jconfig(playerid, params[])
3582{
3583 LoginCheck(playerid);
3584 LevelCheck(playerid, 3);
3585
3586 Config(1, playerid);
3587 return 1;
3588}
3589
3590CMD:setchocolate(playerid, params[])
3591{
3592 LoginCheck(playerid);
3593 LevelCheck(playerid, 3);
3594
3595 new id, string[128], amount;
3596
3597 if(sscanf(params, "ud", id, amount))
3598 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setchocolate [playerid] [amount(cannot be below zero)]");
3599
3600 if(id == INVALID_PLAYER_ID)
3601 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3602
3603 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3604 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3605
3606 format(string, sizeof(string), "Your chocolate has been set from %d to %d by %s.", User[id][accountChocolate], amount, pName(playerid));
3607 SendClientMessage(id, COLOR_YELLOW, string);
3608 format(string, sizeof(string), "You set %s's chocolate from %d to %d..", pName(id), User[id][accountChocolate], amount);
3609 SendClientMessage(playerid, -1, string);
3610
3611 User[id][accountChocolate] = amount;
3612 SaveData(id);
3613 return 1;
3614}
3615
3616CMD:hidemarker(playerid, params[])
3617{
3618 new string[92];
3619
3620 LoginCheck(playerid);
3621 LevelCheck(playerid, 3);
3622
3623 switch(User[playerid][accountMarker])
3624 {
3625 case false:
3626 {
3627 format(string, sizeof(string), "* %s has their marker hidden.", pName(playerid));
3628 SendAdmin(COLOR_ADMIN, string);
3629 User[playerid][accountMarker] = true;
3630 SetPlayerColor(playerid, RemoveAlpha(GetPlayerColor(playerid)));
3631 }
3632 case true:
3633 {
3634 format(string, sizeof(string), "* %s has their marker visible again.", pName(playerid));
3635 SendAdmin(COLOR_ADMIN, string);
3636 User[playerid][accountMarker] = false;
3637 SetPlayerColor(playerid, AddAlpha(GetPlayerColor(playerid)));
3638 }
3639 }
3640 return 1;
3641}
3642
3643CMD:setvotekicklimit(playerid, params[])
3644{
3645 new string[128], limit;
3646
3647 LoginCheck(playerid);
3648 LevelCheck(playerid, 3);
3649
3650 if(sscanf(params, "i", limit))
3651 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvotekicklimit [limit(3-10)]");
3652
3653 if(limit > 3 && limit < 10)
3654 return SendClientMessage(playerid, COLOR_RED, "* The kick-limit must be above 1, but below 10!");
3655
3656 if(limit == MaxVKICK)
3657 {
3658 format(string, sizeof(string), "* The vote-kick limit is already %i!", limit);
3659 return SendClientMessage(playerid, COLOR_RED, string);
3660 }
3661
3662 format(string, sizeof(string), "* Admin %s has changed the required votes for vote-kick to %d.", pName(playerid), limit);
3663 SendClientMessageToAll(COLOR_ADMIN, string);
3664 SaveLog("votekick.txt", string);
3665 MaxVKICK = limit;
3666 return 1;
3667}
3668
3669CMD:forbidword(playerid, params[])
3670{
3671 LoginCheck(playerid);
3672 LevelCheck(playerid, 3);
3673
3674 new string[128], File:BLfile;
3675
3676 if(isnull(params))
3677 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidword [word]");
3678
3679 BLfile = fopen("JakAdmin/ForbiddenWords.cfg", io_append);
3680 format(string, sizeof(string), "%s\r\n", params);
3681 fwrite(BLfile, string);
3682 fclose(BLfile);
3683
3684 format(string, sizeof(string), "Admin %s has added the word %s to the forbidden word list", pName(playerid), params);
3685 SendAdmin(COLOR_ADMIN, string);
3686
3687 UpdateForbidden();
3688 return 1;
3689}
3690
3691CMD:forbidname(playerid, params[])
3692{
3693 LoginCheck(playerid);
3694 LevelCheck(playerid, 3);
3695
3696 new string[128], File:BLfile;
3697
3698 if(isnull(params))
3699 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidname [nickname]");
3700
3701 if(strlen(params) < 3 || strlen(params) > 20)
3702 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidname [nickname]");
3703
3704 BLfile = fopen("JakAdmin/ForbiddenNames.cfg", io_append);
3705 format(string, sizeof(string), "%s\r\n", params);
3706 fwrite(BLfile, string);
3707 fclose(BLfile);
3708
3709 format(string, sizeof(string), "Admin %s has added the name %s to the forbidden name list", pName(playerid), params);
3710 SendAdmin(COLOR_ADMIN, string);
3711
3712 UpdateForbidden();
3713 return 1;
3714}
3715
3716CMD:get(playerid, params[])
3717{
3718 LoginCheck(playerid);
3719 LevelCheck(playerid, 3);
3720
3721 new id, string[92], Float:x, Float:y, Float:z;
3722
3723 if(sscanf(params, "u", id))
3724 return SendClientMessage(playerid, COLOR_RED, "USAGE: /get [playerid]");
3725
3726 if(id == INVALID_PLAYER_ID)
3727 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3728
3729 if(id == playerid)
3730 return SendClientMessage(playerid, COLOR_RED, "* You cannot teleport yourself to yourself.");
3731
3732 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3733 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3734
3735 GetPlayerPos(playerid, x, y, z);
3736 SetPlayerInterior(id, GetPlayerInterior(playerid));
3737 SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
3738
3739 if(GetPlayerState(id) == 2)
3740 {
3741 new VehicleID = GetPlayerVehicleID(id);
3742 SetVehiclePos(VehicleID, x+3, y, z);
3743 LinkVehicleToInterior(VehicleID, GetPlayerInterior(playerid));
3744 SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(playerid));
3745 }
3746 else SetPlayerPos(id, x+2, y, z);
3747
3748 format(string, sizeof(string), "You have been teleported to Admin %s position.", pName(playerid));
3749 SendClientMessage(id, COLOR_YELLOW, string);
3750 format(string, sizeof(string), "You have teleported %s to your position.", pName(id));
3751 SendClientMessage(playerid, COLOR_YELLOW, string);
3752 return 1;
3753}
3754
3755CMD:crash(playerid, params[])
3756{
3757 LoginCheck(playerid);
3758 LevelCheck(playerid, 3);
3759
3760 new id, string[92];
3761
3762 if(sscanf(params, "u", id))
3763 return SendClientMessage(playerid, COLOR_RED, "USAGE: /crash [playerid]");
3764
3765 if(id == INVALID_PLAYER_ID)
3766 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3767
3768 if(User[playerid][accountAdmin] < User[id][accountAdmin] && id != playerid)
3769 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3770
3771 format(string, sizeof(string), "You crashed %s's game.", pName(id));
3772 SendClientMessage(playerid, -1, string);
3773 format(string, sizeof(string), "Admin %s has crashed your game.", pName(playerid));
3774 SendClientMessage(id, COLOR_YELLOW, string);
3775
3776 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
3777 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
3778 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
3779 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
3780 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
3781 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
3782 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
3783 return 1;
3784}
3785
3786CMD:write(playerid, params[])
3787{
3788 LoginCheck(playerid);
3789 LevelCheck(playerid, 3);
3790
3791 new Colour;
3792
3793 if(sscanf(params, "is[128]", Colour, params))
3794 return SendClientMessage(playerid, COLOR_RED, "USAGE: /write [color] [text]") &&
3795 SendClientMessage(playerid, COLOR_GREY, "Colors: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
3796
3797 switch(Colour)
3798 {
3799 case 0: SendClientMessageToAll(COLOR_BLACK, params);
3800 case 1: SendClientMessageToAll(COLOR_WHITE, params);
3801 case 2: SendClientMessageToAll(COLOR_RED, params);
3802 case 3: SendClientMessageToAll(COLOR_ORANGE, params);
3803 case 4: SendClientMessageToAll(COLOR_YELLOW, params);
3804 case 5: SendClientMessageToAll(COLOR_GREEN, params);
3805 case 6: SendClientMessageToAll(COLOR_BLUE, params);
3806 case 7: SendClientMessageToAll(COLOR_PURPLE, params);
3807 case 8: SendClientMessageToAll(COLOR_BROWN, params);
3808 case 9: SendClientMessageToAll(COLOR_PINK, params);
3809 default: SendClientMessage(playerid, COLOR_GREY, "Colors: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
3810 }
3811 return 1;
3812}
3813
3814CMD:force(playerid, params[])
3815{
3816 LoginCheck(playerid);
3817 LevelCheck(playerid, 3);
3818
3819 new string[128], id;
3820
3821 if(sscanf(params, "u", id))
3822 return SendClientMessage(playerid, COLOR_RED, "USAGE: /force [playerid]");
3823
3824 if(id == INVALID_PLAYER_ID)
3825 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3826
3827 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3828 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3829
3830 format(string, sizeof(string), "You have forced %s to goto class selection.", pName(id));
3831 SendClientMessage(playerid, COLOR_YELLOW, string);
3832
3833 format(string, sizeof(string), "Admin %s forced you to goto class selection.", pName(playerid));
3834 SendClientMessage(id, COLOR_YELLOW, string);
3835
3836 SetPlayerHealth(id, 0.0);
3837 ForceClassSelection(id);
3838 return 1;
3839}
3840
3841CMD:healall(playerid, params[])
3842{
3843 LoginCheck(playerid);
3844 LevelCheck(playerid, 3);
3845
3846 new string[128];
3847
3848 foreach(new i : Player)
3849 {
3850 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
3851 {
3852 SetPlayerHealth(i, 100.0);
3853 }
3854 }
3855 format(string, sizeof(string), "ADMIN: Admin %s has healed all players.", pName(playerid));
3856 SendClientMessageToAll(COLOR_ADMIN, string);
3857 return 1;
3858}
3859
3860CMD:setfstyle(playerid, params[])
3861{
3862 LoginCheck(playerid);
3863 LevelCheck(playerid, 3);
3864
3865 new string[128], id, fstyle, style[32];
3866
3867 if(sscanf(params, "ui", id, fstyle))
3868 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setfstyle [playerid] [styles]") &&
3869 SendClientMessage(playerid, COLOR_GREY, "Styles: [0]Normal, [1]Boxing, [2]Kungfu, [3]Kneehead, [4]Grabkick, [5]Elbow");
3870
3871 if(id == INVALID_PLAYER_ID)
3872 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3873
3874 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3875 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3876
3877 if(fstyle > 5)
3878 return SendClientMessage(playerid, COLOR_RED, "* Inavlid Fighting Style.");
3879
3880 switch(fstyle)
3881 {
3882 case 0:
3883 {
3884 SetPlayerFightingStyle(id, 4);
3885 style = "Normal";
3886 }
3887 case 1:
3888 {
3889 SetPlayerFightingStyle(id, 5);
3890 style = "Boxing";
3891 }
3892 case 2:
3893 {
3894 SetPlayerFightingStyle(id, 6);
3895 style = "Kung Fu";
3896 }
3897 case 3:
3898 {
3899 SetPlayerFightingStyle(id, 7);
3900 style = "Kneehead";
3901 }
3902 case 4:
3903 {
3904 SetPlayerFightingStyle(id, 15);
3905 style = "Grabkick";
3906 }
3907 case 5:
3908 {
3909 SetPlayerFightingStyle(id, 16);
3910 style = "Elbow";
3911 }
3912 }
3913 format(string, sizeof(string), "You have set %s(ID:%d) fighting style to '%s'", pName(id), id, style);
3914 SendClientMessage(playerid, COLOR_YELLOW, string);
3915 format(string, sizeof(string), "Admin %s(ID:%d) has set your fighting style to '%s'", pName(playerid), playerid, style);
3916 SendClientMessage(id, COLOR_YELLOW, string);
3917 return 1;
3918}
3919
3920CMD:sethealth(playerid, params[])
3921{
3922 LoginCheck(playerid);
3923 LevelCheck(playerid, 3);
3924
3925 new string[128], id, hp;
3926
3927 if(sscanf(params, "ud", id, hp))
3928 return SendClientMessage(playerid, COLOR_RED, "USAGE: /sethealth [playerid] [heatlh]");
3929
3930 if(id == INVALID_PLAYER_ID)
3931 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3932
3933 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3934 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3935
3936 SetPlayerHealth(id, hp);
3937
3938 format(string, sizeof(string), "You have set %s's health to %d", pName(id), hp);
3939 SendClientMessage(playerid, COLOR_YELLOW, string);
3940 format(string, sizeof(string), "Admin %s has set your health to %d", pName(playerid), hp);
3941 SendClientMessage(id, COLOR_YELLOW, string);
3942 return 1;
3943}
3944
3945CMD:setarmour(playerid, params[])
3946{
3947 LoginCheck(playerid);
3948 LevelCheck(playerid, 3);
3949
3950 new string[128], id, armour;
3951
3952 if(sscanf(params, "ud", id, armour))
3953 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setarmour [playerid] [armour]");
3954
3955 if(id == INVALID_PLAYER_ID)
3956 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3957
3958 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3959 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3960
3961 SetPlayerArmour(id, armour);
3962
3963 format(string, sizeof(string), "You have set %s's armour to %d", pName(id), armour);
3964 SendClientMessage(playerid, COLOR_YELLOW, string);
3965 format(string, sizeof(string), "Admin %s has set your armour to %d", pName(playerid), armour);
3966 SendClientMessage(id, COLOR_YELLOW, string);
3967 return 1;
3968}
3969
3970CMD:destroycar(playerid, params[])
3971{
3972 LoginCheck(playerid);
3973 LevelCheck(playerid, 3);
3974 DelVehicle(GetPlayerVehicleID(playerid));
3975 return 1;
3976}
3977
3978CMD:teleplayer(playerid, params[])
3979{
3980 LoginCheck(playerid);
3981 LevelCheck(playerid, 3);
3982
3983 new string[128],id, id2, Float:x, Float:y, Float:z;
3984
3985 if(sscanf(params, "uu", id, id2))
3986 return SendClientMessage(playerid, COLOR_RED, "USAGE: /teleplayer [playerid] to [playerid2]");
3987
3988 if(User[playerid][accountAdmin] < User[id][accountAdmin])
3989 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3990
3991 if(User[playerid][accountAdmin] < User[id2][accountAdmin])
3992 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3993
3994 if(id == INVALID_PLAYER_ID)
3995 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3996
3997 if(id2 == INVALID_PLAYER_ID)
3998 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3999
4000 if(id == playerid && id2 == playerid)
4001 return SendClientMessage(playerid, COLOR_RED, "* You cannot teleport yourself to yourself!");
4002
4003 GetPlayerPos(id2, x, y, z);
4004 format(string, sizeof(string), "You have teleported %s to %s.", pName(id), pName(id2));
4005 SendClientMessage(playerid, COLOR_YELLOW, string);
4006 format(string, sizeof(string), "You have been teleported to %s by Admin %s.", pName(id2), pName(playerid));
4007 SendClientMessage(id, COLOR_YELLOW, string);
4008 format(string, sizeof(string), "Admin %s has teleported %s to you", pName(playerid), pName(id));
4009 SendClientMessage(id2, COLOR_YELLOW, string);
4010 SetPlayerInterior(id, GetPlayerInterior(id2));
4011 SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(id2));
4012 if(GetPlayerState(id) == 2)
4013 {
4014 SetVehiclePos(GetPlayerVehicleID(id), x+3, y, z);
4015 LinkVehicleToInterior(GetPlayerVehicleID(id), GetPlayerInterior(id2));
4016 SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(id2));
4017 }
4018 else SetPlayerPos(id, x+2, y, z);
4019 return 1;
4020}
4021
4022CMD:armourall(playerid, params[])
4023{
4024 LoginCheck(playerid);
4025 LevelCheck(playerid, 3);
4026
4027 new string[128];
4028
4029 foreach(new i : Player)
4030 {
4031 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4032 {
4033 SetPlayerArmour(i, 100.0);
4034 }
4035 }
4036
4037 format(string, sizeof(string), "ADMIN: Admin %s has given everyone an armour.", pName(playerid));
4038 SendClientMessageToAll(COLOR_ADMIN, string);
4039 return 1;
4040}
4041
4042CMD:bankrupt(playerid, params[])
4043{
4044 LoginCheck(playerid);
4045 LevelCheck(playerid, 3);
4046
4047 new id, string[128];
4048
4049 if(sscanf(params, "u", id))
4050 return SendClientMessage(playerid, COLOR_RED, "USAGE: /bankrupt [playerid]");
4051
4052 if(id == INVALID_PLAYER_ID)
4053 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4054
4055 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4056 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4057
4058 ResetPlayerMoney(id);
4059 format(string, sizeof(string), "Admin %s has taken all your cash in-hand.", pName(playerid));
4060 SendClientMessage(id, COLOR_YELLOW, string);
4061 format(string, sizeof(string), "You have taken all the money in hand of %s.", pName(id));
4062 SendClientMessage(playerid, COLOR_YELLOW, string);
4063 return 1;
4064}
4065
4066CMD:getall(playerid, params[])
4067{
4068 LoginCheck(playerid);
4069 LevelCheck(playerid, 3);
4070
4071 new Float:x, Float:y, Float:z, string[128];
4072
4073 GetPlayerPos(playerid, x, y, z);
4074 foreach(new i : Player)
4075 {
4076 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4077 {
4078 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
4079 SetPlayerPos(i, x+(playerid/4)+1, y+(playerid/4), z);
4080 SetPlayerInterior(i, GetPlayerInterior(playerid));
4081 SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
4082 }
4083 }
4084
4085 format(string, sizeof(string), "ADMIN: Admin %s has teleported everyone to their position.", pName(playerid));
4086 SendClientMessageToAll(COLOR_ADMIN, string);
4087 return 1;
4088}
4089
4090CMD:freeze(playerid, params[])
4091{
4092 LoginCheck(playerid);
4093 LevelCheck(playerid, 3);
4094
4095 new string[128], id, reason[128];
4096
4097 if(sscanf(params, "uS(No Reason)[128]", id, reason))
4098 return SendClientMessage(playerid, COLOR_RED, "USAGE: /freeze [playerid] [reason]");
4099
4100 if(id == INVALID_PLAYER_ID)
4101 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4102
4103 if(id == playerid)
4104 return SendClientMessage(playerid, COLOR_RED, "* You cannot freeze yourself.");
4105
4106 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4107 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4108
4109 TogglePlayerControllable(id, false);
4110
4111 format(string, sizeof(string), "You have frozen %s. (Reason: %s)", pName(id), reason);
4112 SendClientMessage(playerid, COLOR_YELLOW, string);
4113 format(string, sizeof(string), "Admin %s has frozen you (Reason: %s)", pName(playerid), reason);
4114 SendClientMessage(id, COLOR_YELLOW, string);
4115 return 1;
4116}
4117
4118CMD:unfreeze(playerid, params[])
4119{
4120 LoginCheck(playerid);
4121 LevelCheck(playerid, 3);
4122
4123 new string[128], id;
4124
4125 if(sscanf(params, "u", id))
4126 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unfreeze [playerid]");
4127
4128 if(id == INVALID_PLAYER_ID)
4129 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4130
4131 if(id == playerid)
4132 return SendClientMessage(playerid, COLOR_RED, "* You cannot unfreeze yourself.");
4133
4134 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4135 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4136
4137 TogglePlayerControllable(id, true);
4138
4139 format(string, sizeof(string), "You have unfrozen %s.", pName(id));
4140 SendClientMessage(playerid, COLOR_YELLOW, string);
4141 format(string, sizeof(string), "Admin %s has unfrozen you.", pName(playerid));
4142 SendClientMessage(id, COLOR_YELLOW, string);
4143 return 1;
4144}
4145
4146CMD:giveweapon(playerid, params[])
4147{
4148 LoginCheck(playerid);
4149 LevelCheck(playerid, 3);
4150
4151 new id, ammo, wID[32], weap, WeapName[32], string[128];
4152
4153 if(sscanf(params, "us[32]i", id, wID, ammo))
4154 return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveweapon [playerid] [weaponid(or weapon name)] [ammo]");
4155
4156 if(id == INVALID_PLAYER_ID)
4157 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4158
4159 if(ammo <= 0 || ammo > 99999) ammo = 500;
4160 if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
4161 else weap = strval(wID);
4162
4163 if(!IsValidWeapon(weap))
4164 return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID.");
4165 GetWeaponName(weap, WeapName, 32);
4166
4167 format(string, sizeof(string), "You gave a %s(%d) with %d rounds of ammunation to %s.", WeapName, weap, ammo, pName(id));
4168 SendClientMessage(playerid, COLOR_YELLOW, string);
4169 format(string,sizeof(string),"Admin %s has given you a %s(%d) with %d rounds of ammunation.", pName(playerid), WeapName, weap, ammo);
4170 SendClientMessage(id, COLOR_YELLOW, string);
4171 GivePlayerWeapon(id, weap, ammo);
4172 return 1;
4173}
4174
4175CMD:unban(playerid, params[])
4176{
4177 LoginCheck(playerid);
4178 LevelCheck(playerid, 3);
4179
4180 new Account[24];
4181
4182 if(sscanf(params, "s[24]", Account))
4183 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unban [account name]");
4184
4185 UnbanAccount(playerid, Account);
4186 return 1;
4187}
4188
4189CMD:checkban(playerid, params[])
4190{
4191 LoginCheck(playerid);
4192 LevelCheck(playerid, 3);
4193
4194 new query[128], DBResult:result, name[24], admin[24], reason[128], when[32], banid, bandays;
4195
4196 if(sscanf(params, "s[24]", name))
4197 return SendClientMessage(playerid, COLOR_RED, "USAGE: /checkban [name]");
4198
4199 format(query, sizeof(query), "SELECT * FROM `bans` WHERE `username` = '%s'", DB_Escape(name));
4200 result = db_query(Database, query);
4201
4202 if(db_num_rows(result))
4203 {
4204 banid = db_get_field_assoc_int(result, "banid");
4205 db_get_field_assoc(result, "banby", admin, sizeof(admin));
4206 db_get_field_assoc(result, "banreason", reason, sizeof(reason));
4207 db_get_field_assoc(result, "banwhen", when, sizeof(when));
4208 bandays = db_get_field_assoc_int(result, "temporary_ban");
4209
4210 SendClientMessage(playerid, -1, "___________________________________________________");
4211 format(query, sizeof(query), "Name: %s (BanID: %d)", name, banid);
4212 SendClientMessage(playerid, COLOR_RED, query);
4213 format(query, sizeof(query), "Issued By: %s", admin);
4214 SendClientMessage(playerid, COLOR_RED, query);
4215 format(query, sizeof(query), "Reason: %s", reason);
4216 SendClientMessage(playerid, COLOR_RED, query);
4217 format(query, sizeof(query), "Issued On: %s", when);
4218 SendClientMessage(playerid, COLOR_RED, query);
4219 if(bandays == 340703845) // Forever
4220 {
4221 format(query, sizeof(query), "Expires In: Never");
4222 }
4223 else
4224 {
4225 new datestring[32];
4226 datestring = ConvertTimestamp(bandays, 4);
4227 format(query, sizeof(query), "Expires In: %s", datestring);
4228 }
4229 SendClientMessage(playerid, COLOR_RED, query);
4230 SendClientMessage(playerid, -1, "___________________________________________________");
4231 }
4232 else
4233 {
4234 format(query, sizeof(query), "* '%s' is not banned.", name);
4235 SendClientMessage(playerid, COLOR_RED, query);
4236 }
4237 db_free_result(result);
4238 return 1;
4239}
4240
4241CMD:banip(playerid, params[])
4242{
4243 LoginCheck(playerid);
4244 LevelCheck(playerid, 3);
4245
4246 new string[128], ip[24];
4247
4248 if(sscanf(params, "s[24]", ip))
4249 return SendClientMessage(playerid, COLOR_RED, "USAGE: /banip [IP address]");
4250
4251 if(IsValidIP(ip))
4252 return SendClientMessage(playerid, COLOR_RED, "* You have not placed a proper IP format.");
4253
4254 if(CheckBan(ip))
4255 return SendClientMessage(playerid, COLOR_RED, "* IP is already banned.");
4256
4257 AddBan(ip);
4258 format(string, sizeof(string), "[BanIP] %s has banned IP %s.", pName(playerid), ip);
4259 SendAdmin(COLOR_ADMIN, string);
4260 return 1;
4261}
4262
4263CMD:unbanip(playerid, params[])
4264{
4265 LoginCheck(playerid);
4266 LevelCheck(playerid, 3);
4267
4268 new string[128], ip[24];
4269
4270 if(sscanf(params, "s[24]", ip))
4271 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unbanip [IP address]");
4272
4273 if(IsValidIP(ip))
4274 return SendClientMessage(playerid, COLOR_RED, "* You have not placed a proper IP format.");
4275
4276 if(!CheckBan(ip))
4277 return SendClientMessage(playerid, COLOR_RED, "* IP is not banned.");
4278
4279 RemoveBan(ip);
4280 format(string, sizeof(string), "[BanIP] %s has removed IP %s from the ban list.", pName(playerid), ip);
4281 SendAdmin(COLOR_ADMIN, string);
4282 return 1;
4283}
4284
4285CMD:ban(playerid, params[])
4286{
4287 LoginCheck(playerid);
4288 LevelCheck(playerid, 3);
4289
4290 new string[128], id, reason[128], when[64], ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, days, finaldays;
4291
4292 gettime(ban_hr, ban_min, ban_sec);
4293 getdate(ban_years, ban_month, ban_days);
4294
4295 if(sscanf(params, "uS(No Reason)[128]", id, reason, days))
4296 return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban [playerid] [reason(Default: No Reason)] [days(0 for permanent)]");
4297
4298 if(id == INVALID_PLAYER_ID)
4299 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4300
4301 if(id == playerid)
4302 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command to yourself.");
4303
4304 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4305 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4306
4307 format(when, sizeof(when), "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
4308
4309 if(days < 1)
4310 {
4311 format(string, sizeof(string), "ADMIN: %s was permanently-banned from the server by %s (Reason: %s)", pName(id), pName(playerid), reason);
4312 SendClientMessageToAll(COLOR_ADMIN, string);
4313 printf(string);
4314 SaveLog("banlog.txt", string);
4315
4316 format(string, sizeof(string), "You have permanently-banned %s for %s.", pName(id), reason);
4317 SendClientMessage(playerid, COLOR_YELLOW, string);
4318 format(string, sizeof(string), "You have been permanently-banned by %s (Reason: %s)", pName(playerid), reason);
4319 SendClientMessage(id, COLOR_YELLOW, string);
4320 BanAccount(id, pName(playerid), reason);
4321 }
4322 else
4323 {
4324 format(string, sizeof(string), "ADMIN: %s was banned for %d day(s) from the server by %s (Reason: %s)", pName(id), days, pName(playerid), reason);
4325 SendClientMessageToAll(COLOR_ADMIN, string);
4326 printf(string);
4327 SaveLog("banlog.txt", string);
4328
4329 format(string, sizeof(string), "You have banned %s for %d day(s) for %s.", pName(id), days, reason);
4330 SendClientMessage(playerid, COLOR_YELLOW, string);
4331 format(string, sizeof(string), "You have been banned for %d day(s) by %s (Reason: %s)", pName(playerid), days, reason);
4332 SendClientMessage(id, COLOR_YELLOW, string);
4333 BanAccount(id, pName(playerid), reason, days);
4334 }
4335
4336 for(new i; i < 100; i++) SendClientMessage(playerid, -1, " ");
4337
4338 finaldays = (gettime() + 60*60*24*days);
4339 if(!days) finaldays = 340703845;
4340
4341 ShowBan(id, GetPVarInt(id, "ban_id"), pName(playerid), reason, when, finaldays);
4342 KickDelay(id);
4343 return 1;
4344}
4345
4346CMD:oban(playerid, params[])
4347{
4348 LoginCheck(playerid);
4349 LevelCheck(playerid, 3);
4350
4351 new id, string[128], name[24], reason[128], Query[128], admin, ip[20], DBResult:Result, ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, day;
4352
4353 gettime(ban_hr, ban_min, ban_sec);
4354 getdate(ban_years, ban_month, ban_days);
4355
4356 if(sscanf(params, "s[24]s[128]d", name, reason, day))
4357 return SendClientMessage(playerid, COLOR_RED, "USAGE: /oban [name in the data] [reason] [days(0 for permanent)]");
4358
4359 id = ReturnUser(name);
4360 if(IsPlayerConnected(id))
4361 {
4362 format(string, sizeof(string), "* %s is in game, use /ban %d instead.", name, id);
4363 return SendClientMessage(playerid, COLOR_RED, string);
4364 }
4365
4366 format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
4367 Result = db_query(Database, Query);
4368 if(db_num_rows(Result))
4369 {
4370 admin = db_get_field_assoc_int(Result, "admin");
4371 db_get_field_assoc(Result, "IP", ip, 20);
4372
4373 if(User[playerid][accountAdmin] < admin)
4374 {
4375 SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on high ranking admin.");
4376
4377 format(string, sizeof(string), "%s has attempted to offline ban %s but failed for %s", pName(playerid), name, reason);
4378 SaveLog("admin.txt", string);
4379 return 1;
4380 }
4381
4382 BanAccountEx(name, ip, pName(playerid), reason, day);
4383
4384 if(day < 1)
4385 {
4386 format(string, sizeof(string), "ADMIN: %s was offline banned-permanently by %s (Reason: %s)", name, pName(playerid), reason);
4387 }
4388 else
4389 {
4390 format(string, sizeof(string), "ADMIN: %s was offline banned for %d day(s) by %s (Reason: %s)", name, day, pName(playerid), reason);
4391 }
4392 SendAdmin(COLOR_ADMIN, string);
4393 printf(string);
4394 SaveLog("banlog.txt", string);
4395 }
4396 else
4397 {
4398 format(string, sizeof(string), "* There is no '%s' in the server database.", name);
4399 SendClientMessage(playerid, COLOR_RED, string);
4400 }
4401 db_free_result(Result);
4402 return 1;
4403}
4404
4405CMD:cname(playerid, params[])
4406{
4407 LoginCheck(playerid);
4408 LevelCheck(playerid, 3);
4409
4410 new string[128], id, result = 0, newname[24];
4411
4412 if(sscanf(params, "us[24]", id, newname))
4413 return SendClientMessage(playerid, COLOR_RED, "USAGE: /cname [playerid] [new name]");
4414
4415 if(strlen(newname) < 3 || strlen(newname) > 20)
4416 return SendClientMessage(playerid, COLOR_RED, "* Invalid Name Length.");
4417
4418 if(id == INVALID_PLAYER_ID)
4419 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4420 if((result = CheckAccount(newname)) != 0)
4421 {
4422 format(string, sizeof(string), "* This name is already taken (#UserID %d)", result);
4423 SendClientMessage(playerid, COLOR_RED, string);
4424 return 1;
4425 }
4426
4427 if(!User[id][accountLogged])
4428 return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
4429
4430 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4431 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4432
4433 format(string, sizeof string, "Admin %s has set %s's name to %s", pName(playerid), pName(id), newname);
4434 SaveLog("account.txt", string);
4435
4436 format(string, sizeof(string), "You have set %s's name to %s.", pName(id), newname); SendClientMessage(playerid, COLOR_YELLOW, string);
4437 format(string, sizeof(string), "Admin %s has set your name to %s.", pName(playerid), newname); SendClientMessage(id, COLOR_YELLOW, string);
4438 SetPlayerName(id, newname);
4439
4440 SendClientMessage(id, -1, "You have been logged out from your current account, Reconnecting to the server...");
4441
4442 format(string, sizeof(string), "UPDATE `users` SET `username` = '%s' WHERE `userid` = %d", DB_Escape(newname), User[id][accountID]);
4443 db_query(Database, string);
4444 return 1;
4445}
4446
4447CMD:slap(playerid, params[])
4448{
4449 LoginCheck(playerid);
4450 LevelCheck(playerid, 3);
4451
4452 new Float:x, Float:y, Float:z, Float:health, string[128], id, reason[128];
4453
4454 if(sscanf(params, "uS(Not specified)[128]", id, reason))
4455 return SendClientMessage(playerid, COLOR_RED, "USAGE: /slap [playerid] [reason(Default: N/A)]");
4456
4457 if(id == INVALID_PLAYER_ID)
4458 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4459
4460 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4461 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4462
4463 GetPlayerPos(id, x, y, z);
4464 GetPlayerHealth(id, health);
4465 SetPlayerHealth(id, health-25);
4466 SetPlayerPos(id, x, y, z+5);
4467 PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
4468 PlayerPlaySound(id, 1190, 0.0, 0.0, 0.0);
4469
4470 format(string, sizeof(string), "ADMIN: %s has been slapped by %s (Reason: %s)", pName(id), pName(playerid), reason);
4471 SendClientMessageToAll(COLOR_ADMIN, string);
4472 return 1;
4473}
4474
4475CMD:setcolor(playerid, params[])
4476{
4477 LoginCheck(playerid);
4478 LevelCheck(playerid, 3);
4479
4480 new id;
4481 if(sscanf(params, "u", id))
4482 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcolor [playerid]");
4483
4484 if(id == INVALID_PLAYER_ID)
4485 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4486
4487 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4488 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4489
4490 SetPVarInt(playerid, "_Colors_", id);
4491
4492 Dialog_Show(playerid, DIALOG_COLORS, DIALOG_STYLE_LIST, ""green"Colors", ""black"Black\n"white"White\n"red"Red\n"green"Orange\n"yellow"Yellow\n"green"Green\n"blue"Blue\n"purple"Purple\n"brown"Brown\n"pink"Pink", "Set", "Cancel");
4493 return 1;
4494}
4495
4496CMD:setmoney(playerid, params[])
4497{
4498 LoginCheck(playerid);
4499 LevelCheck(playerid, 3);
4500
4501 new id, string[128], amount;
4502
4503 if(sscanf(params, "ui", id, amount))
4504 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setmoney [playerid] [cash]");
4505
4506 if(id == INVALID_PLAYER_ID)
4507 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4508
4509 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4510 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4511
4512 ResetPlayerMoney(id);
4513 GivePlayerMoney(id, amount);
4514 format(string, sizeof(string), "You have set %s's cash to $%i.", pName(id), amount);
4515 SendClientMessage(playerid, COLOR_YELLOW, string);
4516 format(string, sizeof(string), "Admin %s has set your cash to $%i.", pName(playerid), amount);
4517 SendClientMessage(id, COLOR_YELLOW, string);
4518
4519 format(string, sizeof string, "Admin %s has set %s's cash to $%i", pName(playerid), pName(id), amount);
4520 SaveLog("set.txt", string);
4521 return 1;
4522}
4523
4524CMD:setscore(playerid, params[])
4525{
4526 LoginCheck(playerid);
4527 LevelCheck(playerid, 3);
4528
4529 new id, string[128], amount;
4530
4531 if(sscanf(params, "ui", id, amount))
4532 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setscore [playerid] [score]");
4533
4534 if(id == INVALID_PLAYER_ID)
4535 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4536
4537 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4538 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4539
4540 SetPlayerScore(id, amount);
4541 format(string, sizeof(string), "You have set %s's score to %i.", pName(id), amount);
4542 SendClientMessage(playerid, COLOR_YELLOW, string);
4543 format(string, sizeof(string), "Admin %s has set your score to %i.", pName(playerid), amount);
4544 SendClientMessage(id, COLOR_YELLOW, string);
4545
4546 format(string, sizeof string, "Admin %s has set %s's score to %i", pName(playerid), pName(id), amount);
4547 SaveLog("set.txt", string);
4548 return 1;
4549}
4550
4551//============================================================================//
4552// Administrative Level Four //
4553//============================================================================//
4554
4555CMD:lockchat(playerid, params[])
4556{
4557 new string[92];
4558
4559 LoginCheck(playerid);
4560 LevelCheck(playerid, 4);
4561
4562 switch(ServerInfo[LockChat])
4563 {
4564 case false:
4565 {
4566 format(string, sizeof(string), "* Admin %s has locked the chat.", pName(playerid));
4567 SendClientMessageToAll(COLOR_ADMIN, string);
4568 print(string);
4569 ServerInfo[LockChat] = true;
4570 }
4571 case true:
4572 {
4573 format(string, sizeof(string), "* Admin %s has unlocked the chat.", pName(playerid));
4574 SendClientMessageToAll(COLOR_ADMIN, string);
4575 print(string);
4576 ServerInfo[LockChat] = false;
4577 }
4578 }
4579 SaveConfig();
4580 return 1;
4581}
4582
4583CMD:jjjreloadcfg(playerid, params[])
4584{
4585 new string[92];
4586
4587 LoginCheck(playerid);
4588 LevelCheck(playerid, 4);
4589
4590 format(string, sizeof(string), "[CFG] %s has reload the cfgs files for JakAdmin.", pName(playerid));
4591 SendAdmin(COLOR_ADMIN, string);
4592
4593 checkfolder();
4594
4595 printf("[CFG] %s has reload the cgs files for JakAdmin.", pName(playerid));
4596 return 1;
4597}
4598
4599CMD:setpass(playerid, params[])
4600{
4601 LoginCheck(playerid);
4602 LevelCheck(playerid, 4);
4603
4604 new NewPass[24], AccountName[24], string[128], Buf[129], Query[300], DBResult:Result;
4605
4606 if(sscanf(params, "s[24]s[24]", AccountName, NewPass))
4607 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setpass [account name] [new pass]");
4608
4609 if(strlen(NewPass) < 4 || strlen(NewPass) > 20)
4610 return SendClientMessage(playerid, COLOR_RED, "* New password length shouldn't go below four and shouldn't go below twenty.");
4611
4612 WP_Hash(Buf, 129, NewPass);
4613
4614 format(Query, sizeof(Query), "SELECT `userid` FROM `users` WHERE `username` = '%s'", DB_Escape(AccountName));
4615 Result = db_query(Database, Query);
4616
4617 if(db_num_rows(Result))
4618 {
4619 format(Query, sizeof(Query), "UPDATE `users` SET `password` = '%s' WHERE `username` = '%s'", DB_Escape(Buf), DB_Escape(AccountName));
4620 db_query(Database, Query);
4621
4622 format(string, sizeof string, "Admin %s has changed %s's password to %s.", pName(playerid), AccountName, NewPass);
4623 SaveLog("account.txt", string);
4624 format(string, sizeof string, "PASSWORD: Admin %s has changed %s's password.", pName(playerid), AccountName);
4625 SendAdmin(COLOR_GREEN, string);
4626
4627 format(string, sizeof(string), "You have changed %s's password to %s.", AccountName, NewPass);
4628 SendClientMessage(playerid, COLOR_YELLOW, string);
4629 }
4630 else
4631 {
4632 format(string, sizeof(string), "* Account: %s doesn't exist.", AccountName);
4633 SendClientMessage(playerid, COLOR_RED, string);
4634 }
4635 db_free_result(Result);
4636 return 1;
4637}
4638
4639CMD:jsettings(playerid, params[])
4640{
4641 LoginCheck(playerid);
4642 LevelCheck(playerid, 4);
4643
4644 ShowSettings(playerid);
4645 return 1;
4646}
4647
4648CMD:setonline(playerid, params[])
4649{
4650 LoginCheck(playerid);
4651 LevelCheck(playerid, 4);
4652
4653 new id, hours, minutes, seconds, string[128];
4654
4655 if(sscanf(params, "uddd", id, hours, minutes, seconds))
4656 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setonline [playerid] [hour] [minutes] [seconds]");
4657
4658 if(id == INVALID_PLAYER_ID)
4659 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4660
4661 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4662 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4663
4664 if(hours < 0)
4665 return SendClientMessage(playerid, COLOR_RED, "* You cannot set the hours lower than zero.");
4666
4667 if(minutes < 0 || minutes > 59)
4668 return SendClientMessage(playerid, COLOR_RED, "* You cannot set the minutes lower than zero and more than fifty nine.");
4669
4670 if(seconds < 0 || seconds > 59)
4671 return SendClientMessage(playerid, COLOR_RED, "* You cannot set the seconds lower than zero and more than fifty nine.");
4672
4673 format(string, sizeof(string), "* Your total time has been set from %02d:%02d:%02d to %02d:%02d:%02d by %s.", User[id][accountGame][2], User[id][accountGame][1], User[id][accountGame][0], hours, minutes, seconds, pName(playerid));
4674 SendClientMessage(id, COLOR_YELLOW, string);
4675 format(string, sizeof(string), "* You have set %s's total time to %02d:%02d:%02d.", pName(id), hours, minutes, seconds);
4676 SendClientMessage(playerid, -1, string);
4677
4678 User[id][accountGame][2] = hours;
4679 User[id][accountGame][1] = minutes;
4680 User[id][accountGame][0] = seconds;
4681
4682 SaveData(id);
4683 return 1;
4684}
4685
4686CMD:gmx(playerid, params[])
4687{
4688 new string[128], time;
4689
4690 LoginCheck(playerid);
4691 LevelCheck(playerid, 4);
4692
4693 if(sscanf(params, "I(0)", time))
4694 return SendClientMessage(playerid, COLOR_RED, "USAGE: /gmx [Restart Timer(optional)") &&
4695 SendClientMessage(playerid, -1, "Note: You can leave the parameter for a fast restart, no timers.");
4696
4697 if(time < 10 && time !=0)
4698 return SendClientMessage(playerid, COLOR_RED, "* Restart Time shouldn't go below ten.");
4699
4700 if(time >= 10)
4701 {
4702 format(string, sizeof(string), "Admin %s has initiated a server restart, Estimated Time of Restart: %d.", pName(playerid), time);
4703 SendClientMessageToAll(COLOR_ADMIN, string);
4704 SetTimer("RestartTimer", 1000*time, false);
4705 }
4706 else
4707 {
4708 format(string, sizeof(string), "Admin %s has restarted the server.", pName(playerid), playerid);
4709 SendClientMessageToAll(COLOR_ADMIN, string);
4710 SendRconCommand("gmx");
4711 }
4712 return 1;
4713}
4714
4715function:RestartTimer()
4716{
4717 SendClientMessageToAll(COLOR_YELLOW, "Restart Time has been reached, Restarting the server now.");
4718 return SendRconCommand("gmx");
4719}
4720
4721CMD:fakedeath(playerid, params[])
4722{
4723 new string[128], id, killerid, weapid;
4724
4725 LoginCheck(playerid);
4726 LevelCheck(playerid, 4);
4727
4728 if(sscanf(params, "uui", killerid, id, weapid))
4729 return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakedeath [killer] [victim] [weapon]");
4730
4731 if(killerid == INVALID_PLAYER_ID)
4732 return SendClientMessage(playerid, COLOR_RED, "* KillerID not connected.");
4733 if(id == INVALID_PLAYER_ID)
4734 return SendClientMessage(playerid, COLOR_RED, "* VictimID not connected.");
4735
4736 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4737 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4738
4739 if(User[playerid][accountAdmin] < User[killerid][accountAdmin])
4740 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4741
4742 if(id == playerid && killerid == playerid)
4743 return SendClientMessage(playerid, COLOR_RED, "* You can't be KillerID and VictimID at the same time.");
4744 if(!IsValidWeapon(weapid))
4745 return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID.");
4746
4747 SendDeathMessage(killerid, id, weapid);
4748
4749 format(string, sizeof(string), "Fake Death Sent. [ Victim: %s(%d) | Suspect: %s(%d) | WeaponID: %i ]", pName(id), id, pName(killerid), killerid, weapid);
4750 SendClientMessage(playerid, COLOR_YELLOW, string);
4751 return 1;
4752}
4753
4754CMD:setallskin(playerid, params[])
4755{
4756 new string[92], skin;
4757
4758 LoginCheck(playerid);
4759 LevelCheck(playerid, 4);
4760
4761 if(sscanf(params, "i", skin))
4762 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallskin [skin(0-311)]");
4763
4764 if(skin < 0 || skin == 74 || skin > 311)
4765 return SendClientMessage(playerid, COLOR_RED, "* Invalid skinID.");
4766
4767 foreach(new i : Player)
4768 {
4769 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4770 {
4771 SetPlayerSkin(i, skin);
4772 }
4773 }
4774
4775 format(string, sizeof(string), "ADMIN: Admin %s has set everyones skin to %d.", pName(playerid), skin);
4776 SendClientMessageToAll(COLOR_ADMIN, string);
4777 return 1;
4778}
4779
4780CMD:cmdmuted(playerid, params[])
4781{
4782 new string[128], count = 0;
4783
4784 SendClientMessage(playerid, -1, "** "green"Command Muted Players "white"**");
4785 foreach(new i : Player)
4786 {
4787 if(User[i][accountLogged] == 1)
4788 {
4789 if(User[i][accountCMuted] == 1)
4790 {
4791 format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountCMuteSec]);
4792 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
4793 count++;
4794 }
4795 }
4796 }
4797 if(count == 0) return SendClientMessage(playerid, -1, "No command muted players at the server.");
4798 return 1;
4799}
4800
4801CMD:mutecmd(playerid, params[])
4802{
4803 LoginCheck(playerid);
4804 LevelCheck(playerid, 4);
4805
4806 new id, sec, reason[128], string[128];
4807
4808 if(sscanf(params, "uD(-1)S(None)[128]", id, sec, reason))
4809 return SendClientMessage(playerid, COLOR_RED, "USAGE: /mutecmd [playerid] [seconds(optional for permanent)] [reason(optional)]");
4810
4811 if(id == INVALID_PLAYER_ID)
4812 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4813
4814 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4815 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4816
4817 if(sec < 30 && sec != -1)
4818 return SendClientMessage(playerid, COLOR_RED, "* You cannot mute lower than 30 seconds.");
4819
4820 if(User[id][accountCMuted])
4821 return SendClientMessage(playerid, COLOR_RED, "* Player already muted from using the commands.");
4822
4823 if(id == playerid)
4824 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
4825
4826 if(sec != -1)
4827 {
4828 format(string, sizeof(string), "ADMIN: %s was muted from using commands for %d seconds by %s (Reason: %s)", pName(id), sec, pName(playerid), reason);
4829 SendClientMessageToAll(COLOR_ADMIN, string);
4830 format(string, sizeof(string), "You have been muted from using commands for %d seconds by %s (Reason: %s)", sec, pName(playerid), reason);
4831 SendClientMessage(id, -1, string);
4832
4833 format(string, sizeof(string), "%s has been muted from using commands by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
4834 SaveLog("mute.txt", string);
4835 }
4836 else
4837 {
4838 format(string, sizeof(string), "ADMIN: %s was permanently muted from using commands by %s (Reason: %s)", pName(id), pName(playerid), reason);
4839 SendClientMessageToAll(COLOR_ADMIN, string);
4840 format(string, sizeof(string), "You have been muted permanently from using commands by %s (Reason: %s).", pName(playerid), reason);
4841 SendClientMessage(id, -1, string);
4842
4843 format(string, sizeof(string), "%s has been muted from using commands by %s (reason %s)", pName(id), pName(playerid), reason);
4844 SaveLog("mute.txt", string);
4845 }
4846
4847 User[id][accountCMuted] = 1;
4848 User[id][accountCMuteSec] = sec;
4849 return 1;
4850}
4851
4852CMD:unmutecmd(playerid, params[])
4853{
4854 LoginCheck(playerid);
4855 LevelCheck(playerid, 4);
4856
4857 new id, reason[128], string[128];
4858
4859 if(sscanf(params, "uS(None)[128]", id, reason))
4860 return SendClientMessage(playerid, COLOR_RED, "USAGE: /unmutecmd [playerid] [reason]");
4861
4862 if(id == INVALID_PLAYER_ID)
4863 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4864
4865 if(User[playerid][accountAdmin] < User[id][accountAdmin])
4866 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4867
4868 if(!User[id][accountCMuted])
4869 return SendClientMessage(playerid, COLOR_RED, "* Player not muted from using the commands.");
4870
4871 if(id == playerid)
4872 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
4873
4874 format(string, sizeof(string), "ADMIN: %s was unmuted from using commands by %s for %s", pName(id), pName(playerid), reason);
4875 SendClientMessageToAll(COLOR_ADMIN, string);
4876 format(string, sizeof(string), "You have been unmuted from using commands by %s.", pName(playerid));
4877 SendClientMessage(id, COLOR_GREEN, string);
4878
4879 format(string, sizeof(string), "%s has been unmuted from using commands by %s", pName(id), pName(playerid));
4880 SaveLog("mute.txt", string);
4881
4882 User[id][accountCMuted] = 0;
4883 User[id][accountCMuteSec] = 0;
4884 return 1;
4885}
4886
4887CMD:giveallchocolate(playerid, params[])
4888{
4889 LoginCheck(playerid);
4890 LevelCheck(playerid, 4);
4891
4892 new string[128], amount;
4893
4894 if(sscanf(params, "d", amount))
4895 return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallchocolate [amount]");
4896
4897 if(amount < 1)
4898 return SendClientMessage(playerid, COLOR_RED, "* Invalid amount.");
4899
4900 foreach(new i : Player)
4901 {
4902 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4903 {
4904 User[i][accountChocolate] += amount;
4905 }
4906 }
4907
4908 format(string, sizeof(string), "** Admin %s has given everyone %d chocolate(s).", pName(playerid), amount);
4909 SendClientMessageToAll(COLOR_ADMIN, string);
4910 printf(string);
4911 return 1;
4912}
4913
4914CMD:kickall(playerid, params[])
4915{
4916 LoginCheck(playerid);
4917 LevelCheck(playerid, 4);
4918
4919 new string[92];
4920
4921 foreach(new i : Player)
4922 {
4923 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4924 {
4925 KickDelay(i);
4926 }
4927 }
4928
4929 format(string, sizeof(string), "** Admin %s has kicked all players.", pName(playerid));
4930 SendClientMessageToAll(COLOR_YELLOW, string);
4931 printf(string);
4932
4933 SaveLog("kicklog.txt", string);
4934 return 1;
4935}
4936
4937CMD:disarmall(playerid, params[])
4938{
4939 LoginCheck(playerid);
4940 LevelCheck(playerid, 4);
4941
4942 new string[92];
4943
4944 foreach(new i : Player)
4945 {
4946 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4947 {
4948 ResetPlayerWeapons(i);
4949 }
4950 }
4951 format(string, sizeof(string), "** Admin %s has removed everyones weapon.", pName(playerid));
4952 SendClientMessageToAll(COLOR_ADMIN, string);
4953 return 1;
4954}
4955
4956CMD:giveallscore(playerid, params[])
4957{
4958 LoginCheck(playerid);
4959 LevelCheck(playerid, 4);
4960
4961 new id, string[128];
4962
4963 if(sscanf(params, "i", id))
4964 return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallscore [score]");
4965
4966 foreach(new i : Player)
4967 {
4968 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4969 {
4970 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
4971 SetPlayerScore(i, GetPlayerScore(i) + id);
4972 }
4973 }
4974
4975 format(string, sizeof(string), "** Admin %s has given everyone a score of %d", pName(playerid), id);
4976 SendClientMessageToAll(COLOR_ADMIN, string);
4977 return 1;
4978}
4979
4980CMD:giveallcash(playerid, params[])
4981{
4982 LoginCheck(playerid);
4983 LevelCheck(playerid, 4);
4984
4985 new id, string[128];
4986
4987 if(sscanf(params, "i", id))
4988 return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallcash [money]");
4989
4990 foreach(new i : Player)
4991 {
4992 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
4993 {
4994 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
4995 GivePlayerMoney(i, id);
4996 }
4997 }
4998
4999 format(string, sizeof(string), "* Admin %s has given everyone a $%d.", pName(playerid), id);
5000 SendClientMessageToAll(COLOR_ADMIN, string);
5001 return 1;
5002}
5003
5004CMD:setalltime(playerid, params[])
5005{
5006 LoginCheck(playerid);
5007 LevelCheck(playerid, 4);
5008
5009 new id, string[128];
5010
5011 if(sscanf(params, "i", id))
5012 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setalltime [time(0-23)]");
5013
5014 if(id < 0 || id > 23)
5015 return SendClientMessage(playerid, COLOR_RED, "* Invalid Time Hour (0-23).");
5016
5017 foreach(new i : Player)
5018 {
5019 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
5020 {
5021 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
5022 SetPlayerTime(i, id, 0);
5023 }
5024 }
5025
5026 format(string, sizeof(string), "** Admin %s has set everyones time to %d:00.", pName(playerid), id);
5027 SendClientMessageToAll(COLOR_ADMIN, string);
5028 return 1;
5029}
5030
5031CMD:setallweather(playerid, params[])
5032{
5033 LoginCheck(playerid);
5034 LevelCheck(playerid, 4);
5035
5036 new id, string[128];
5037
5038 if(sscanf(params, "i", id))
5039 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallweather [weather(0-45)]");
5040
5041 if(id < 0 || id > 45)
5042 return SendClientMessage(playerid, COLOR_RED, "* Invalid Weather ID! (0-45)");
5043
5044 foreach(new i : Player)
5045 {
5046 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
5047 {
5048 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
5049 SetPlayerWeather(i, id);
5050 }
5051 }
5052
5053 format(string, sizeof(string), "** Admin %s has set everyones weather to %d", pName(playerid), id);
5054 SendClientMessageToAll(COLOR_ADMIN, string);
5055 return 1;
5056}
5057
5058CMD:respawncars(playerid, params[])
5059{
5060 LoginCheck(playerid);
5061 LevelCheck(playerid, 4);
5062
5063 new string[92];
5064
5065 format(string, sizeof(string), "** Admin %s has respawned all unoccupied vehicles.", pName(playerid));
5066 SendClientMessageToAll(COLOR_ADMIN, string);
5067
5068 SendClientMessage(playerid, COLOR_GREEN, "You have successfully Respawned all Vehicles!");
5069 GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000, 3);
5070
5071 for(new cars=0; cars<MAX_VEHICLES; cars++)
5072 {
5073 if(!VehicleOccupied(cars))
5074 {
5075 SetVehicleToRespawn(cars);
5076 }
5077 }
5078 return 1;
5079}
5080
5081CMD:cleardwindow(playerid, params[])
5082{
5083 LoginCheck(playerid);
5084 LevelCheck(playerid, 4);
5085
5086 new string[92];
5087
5088 format(string, sizeof(string), "** Admin %s has cleared the Death Window!", pName(playerid));
5089 SendClientMessageToAll(COLOR_ADMIN, string);
5090 for(new i = 0; i < 20; i++) SendDeathMessage(6000, 5005, 255);
5091 return 1;
5092}
5093
5094CMD:saveallstats(playerid, params[])
5095{
5096 LoginCheck(playerid);
5097 LevelCheck(playerid, 4);
5098
5099 new string[128];
5100
5101 format(string, sizeof string, "** Admin %s has saved all player's stats.", pName(playerid));
5102 SendClientMessageToAll(COLOR_ADMIN, string);
5103
5104 foreach(new i : Player)
5105 {
5106 SaveData(i);
5107 }
5108
5109 format(string, sizeof string, "Admin %s has saved all player's stats.", pName(playerid));
5110 SaveLog("account.txt", string);
5111 return 1;
5112}
5113
5114CMD:giveallweapon(playerid, params[])
5115{
5116 LoginCheck(playerid);
5117 LevelCheck(playerid, 4);
5118
5119 new ammo, wID[32], weap, WeapName[32], string[128];
5120
5121 if(sscanf(params, "s[32]i", wID, ammo))
5122 return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallweapon [weaponid(or name)] [ammo]");
5123
5124 if(ammo <= 0 || ammo > 99999) ammo = 500;
5125 if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
5126 else weap = strval(wID);
5127
5128 if(!IsValidWeapon(weap))
5129 return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID");
5130
5131 GetWeaponName(weap, WeapName, 32);
5132 foreach(new i : Player)
5133 {
5134 if(i != playerid && User[playerid][accountAdmin] > User[i][accountAdmin])
5135 {
5136 GivePlayerWeapon(i, weap, ammo);
5137 format(string, sizeof string, "~g~%s for all!", WeapName);
5138 GameTextForPlayer(i, string, 2500, 3);
5139 }
5140 }
5141
5142 format(string,sizeof(string), "** Admin %s has given everyone a %s(%d).", pName(playerid), WeapName, weap);
5143 SendClientMessageToAll(COLOR_ADMIN, string);
5144 return 1;
5145}
5146
5147//============================================================================//
5148// Administrative Level Five //
5149//============================================================================//
5150
5151CMD:rcons(playerid, params[])
5152{
5153 LoginCheck(playerid);
5154 LevelCheck(playerid, 5);
5155
5156 static string[128 * 10];
5157 string[0] = 0;
5158 new count = 0;
5159
5160 foreach(new i : Player)
5161 {
5162 if(IsPlayerAdmin(i))
5163 {
5164 format(string, sizeof(string), "%s"white"(%d) %s - (%s)\n", string, i, pName(i), User[i][accountIP]);
5165 count++;
5166 }
5167 }
5168
5169 if(!count)
5170 return SendClientMessage(playerid, -1, "No RCON admins online at the server.");
5171
5172 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, "RCONs", string, "CLOSE", "");
5173 return 1;
5174}
5175
5176CMD:createaccount(playerid, params[])
5177{
5178 LoginCheck(playerid);
5179 LevelCheck(playerid, 5);
5180
5181 new name[24], password[20], hash[129], DBResult:result, query[128 * 3];
5182 //Time = Hours, Time2 = Minutes, Time3 = Seconds
5183 new time, time2, time3;
5184 gettime(time, time2, time3);
5185 new date, date2, date3;
5186 //Date = Month, Date2 = Day, Date3 = Year
5187 getdate(date3, date, date2);
5188
5189 if(sscanf(params, "s[24]s[20]", name, password))
5190 return SendClientMessage(playerid, COLOR_RED, "USAGE: /createaccount [name] [password]");
5191
5192 if(strlen(name) < 5 || strlen(name) > 20)
5193 return SendClientMessage(playerid, COLOR_RED, "* Account Name's length must be more than five but can't be above twenty.");
5194
5195 if(strlen(password) < 4 || strlen(password) > 20)
5196 return SendClientMessage(playerid, COLOR_RED, "* Password length must be more than four but can't be above twenty.");
5197
5198 format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
5199 result = db_query(Database, query);
5200
5201 if(!db_num_rows(result))
5202 {
5203 WP_Hash(hash, sizeof(hash), password);
5204
5205 format(query, sizeof(query),
5206 "INSERT INTO `users` (`username`, `IP`, `joindate`, `password`, `score`, `money`) VALUES ('%s', '255.255.255.255', '%02d/%02d/%d %02d:%02d:%02d', '%s', %d, %d)",\
5207 DB_Escape(name),
5208 date, date2, date3, time, time2, time3,
5209 DB_Escape(hash),
5210 STARTING_SCORE,
5211 STARTING_CASH
5212 );
5213 db_query(Database, query);
5214
5215 format(query, sizeof(query), "* You have successfully created an account under the name '%s' with password '%s'", name, password);
5216 SendClientMessage(playerid, COLOR_GREEN, query);
5217
5218 printf("[ACCOUNT] %s (IP: %s) has created a new account name '%s' (/createaccount)", pName(playerid), User[playerid][accountIP], name);
5219 }
5220 else
5221 {
5222 format(query, sizeof(query), "* '%s' is taken.", name);
5223 SendClientMessage(playerid, COLOR_RED, query);
5224 }
5225 db_free_result(result);
5226 return 1;
5227}
5228
5229CMD:setaccount(playerid, params[])
5230{
5231 LoginCheck(playerid);
5232 LevelCheck(playerid, 5);
5233
5234 new name[24], DBResult:result, query[128 * 3], type[32], optional[128];
5235
5236 if(sscanf(params, "s[24]s[32]S()[128]", name, type, optional))
5237 {
5238 SendClientMessage(playerid, COLOR_RED, "USAGE: /setaccount [name] [type] (optional)");
5239 SendClientMessage(playerid, COLOR_YELLOW, "Types: Admin, Name");
5240 return 1;
5241 }
5242
5243 new id = ReturnUser(name);
5244
5245 format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
5246 result = db_query(Database, query);
5247
5248 if(db_num_rows(result))
5249 {
5250 if(!strcmp(type, "admin", true))
5251 {
5252 new level;
5253 if(sscanf(optional, "d", level))
5254 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setaccount [name] admin [0-5]");
5255
5256 if(level < 0 || level > 5)
5257 return SendClientMessage(playerid, COLOR_RED, "* Admin Level can't be below zero and can't be above five.");
5258
5259 if(IsPlayerConnected(id))
5260 {
5261 format(query, sizeof(query), "* '%s' is in game, use /setlevel %d instead.", name, id);
5262 return SendClientMessage(playerid, COLOR_RED, query);
5263 }
5264
5265 format(query, sizeof(query), "UPDATE `users` SET `admin` = %d WHERE `username` = '%s'", level, DB_Escape(name));
5266 db_query(Database, query);
5267
5268 format(query, sizeof(query), "* You have set %s's Admin level to %d. (/setaccount)", name, level);
5269 SendClientMessage(playerid, COLOR_GREEN, query);
5270
5271 printf("[ACCOUNT] %s (IP: %s) has set %s's admin level to %d. (/setaccount)", pName(playerid), User[playerid][accountIP], name, level);
5272 }
5273 else if(!strcmp(type, "name", true))
5274 {
5275 new str[24];
5276 if(sscanf(optional, "s[24]", str))
5277 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setaccount [name] name [new name]");
5278
5279 if(strlen(str) < 5 || strlen(str) > 20)
5280 return SendClientMessage(playerid, COLOR_RED, "* Name Length can't be below five and can't be above twenty.");
5281
5282 if(IsPlayerConnected(id))
5283 {
5284 format(query, sizeof(query), "* '%s' is in game, use /setname %d instead.", name, id);
5285 return SendClientMessage(playerid, COLOR_RED, query);
5286 }
5287
5288 format(query, sizeof(query), "UPDATE `users` SET `username` = '%s' WHERE `username` = '%s'", DB_Escape(str), DB_Escape(name));
5289 db_query(Database, query);
5290
5291 format(query, sizeof(query), "* You have set %s's name to %s. (/setaccount)", name, str);
5292 SendClientMessage(playerid, COLOR_GREEN, query);
5293
5294 printf("[ACCOUNT] %s (IP: %s) has set %s's name to %s. (/setaccount)", pName(playerid), User[playerid][accountIP], name, str);
5295 }
5296 else
5297 {
5298 SendClientMessage(playerid, COLOR_RED, "* Invalid type.");
5299 }
5300 }
5301 else
5302 {
5303 format(query, sizeof(query), "* '%s' doesn't exist.", name);
5304 SendClientMessage(playerid, COLOR_RED, query);
5305 }
5306 db_free_result(result);
5307 return 1;
5308}
5309
5310CMD:makemegodadmin(playerid, params[])
5311{
5312 if(!IsPlayerAdmin(playerid))
5313 return SendClientMessage(playerid, COLOR_RED, "* Only RCON can use this command.");
5314
5315 User[playerid][accountAdmin] = 5;
5316 SendClientMessage(playerid, COLOR_ADMIN, "You have set your administrative rank to level 5.");
5317 return 1;
5318}
5319
5320CMD:removeaccount(playerid, params[])
5321{
5322 LoginCheck(playerid);
5323 LevelCheck(playerid, 5);
5324
5325 new
5326 Account[MAX_PLAYER_NAME],
5327 Reason[100],
5328 string[128]
5329 ;
5330 if(sscanf(params, "s[24]s[100]", Account, Reason))
5331 return SendClientMessage(playerid, COLOR_RED, "USAGE: /removeacc [account name] [reason]");
5332
5333 if(DataExist(Account))
5334 {
5335 if(!strcmp(pName(playerid), Account, false))
5336 return SendClientMessage(playerid, COLOR_RED, "* You cannot delete your own account!");
5337
5338 foreach(new i : Player)
5339 {
5340 if(strcmp(Account, pName(i), true) == 0)
5341 {
5342 SendClientMessage(playerid, COLOR_RED, "* Player is online, fail to delete the account.");
5343 return 1;
5344 }
5345 }
5346
5347 new Query[128];
5348 format(Query, sizeof(Query), "DELETE FROM `users` WHERE `username` = '%s'", Account);
5349 db_query(Database, Query);
5350
5351 format(string, sizeof(string), "Admin %s(ID: %d) has deleted %s's account [Reason: %s]", pName(playerid), playerid, Account, Reason);
5352 SendClientMessageToAll(COLOR_YELLOW, string);
5353 SaveLog("account.txt", string);
5354
5355 format(string, sizeof(string), "You have deleted %s's account [Reason: %s]", Account, Reason);
5356 SendClientMessage(playerid, COLOR_YELLOW, string);
5357 }
5358 else
5359 {
5360 SendClientMessage(playerid, COLOR_RED, "* Account does not exist in the database!");
5361 }
5362 return 1;
5363}
5364
5365CMD:fakecmd(playerid, params[])
5366{
5367 new string[128], id, cmdtext[128];
5368
5369 LoginCheck(playerid);
5370 LevelCheck(playerid, 5);
5371
5372 if(sscanf(params, "us[128]", id, cmdtext)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakecmd [playerid] [command]");
5373 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5374 if(strfind(params, "/", false) != -1)
5375 {
5376 CallRemoteFunction("OnPlayerCommandText", "is", id, cmdtext);
5377 format(string, sizeof(string), "Fake command sent to %s with %s", pName(id), cmdtext);
5378 SendClientMessage(playerid, COLOR_YELLOW, string);
5379 }
5380 else return SendClientMessage(playerid, COLOR_RED, "* Add '/' before putting the command name to avoid the command unknown error.");
5381 return 1;
5382}
5383
5384CMD:fakechat(playerid, params[])
5385{
5386 LoginCheck(playerid);
5387 LevelCheck(playerid, 5);
5388
5389 new
5390 string[128],
5391 id,
5392 text[128]
5393 ;
5394
5395 if(sscanf(params, "us[128]", id, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakechat [playerid] [text]");
5396 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5397 format(string, sizeof(string), "You have faked chat %s with %s", pName(id), text);
5398 SendClientMessage(playerid, COLOR_YELLOW, string);
5399 SendPlayerMessageToAll(id, text);
5400 return 1;
5401}
5402
5403CMD:settemplevel(playerid, params[])
5404{
5405 new string[128], id, level;
5406
5407 LoginCheck(playerid);
5408 LevelCheck(playerid, 5);
5409
5410 if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /settemplevel [playerid] [level(0/5)]");
5411 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5412 if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_RED, "* Levels shouldn't go below zero and shouldn't go above five.");
5413 if(level == User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* Player is already in that level.");
5414 if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
5415
5416 if(User[id][accountAdmin] < level)
5417 {
5418 format(string, 128, "You have been temporarily-promoted to level %d by %s.", level, pName(playerid));
5419 SendClientMessage(id, COLOR_YELLOW, string);
5420 format(string, 128, "You have temporarily-promoted %s to level %d.", pName(id), level);
5421 SendClientMessage(playerid, COLOR_YELLOW, string);
5422 format(string, 128, "You will be promoted back to your old level which is (%d) once you logout.", User[id][accountAdmin]);
5423 SendClientMessage(id, COLOR_GREEN, string);
5424 }
5425 else if(User[id][accountAdmin] > level)
5426 {
5427 format(string, 128, "You have been temporarily-demoted to level %d by %s.", level, pName(playerid));
5428 SendClientMessage(id, COLOR_YELLOW, string);
5429 format(string, 128, "You have temporarily-demoted %s to level %d.", pName(id), level);
5430 SendClientMessage(playerid, COLOR_YELLOW, string);
5431 format(string, 128, "You will be promoted back to your old level which is (%d) once you logout.", User[id][accountAdmin]);
5432 SendClientMessage(id, COLOR_GREEN, string);
5433 }
5434
5435 User[id][accountTemporary] = true;
5436 User[id][accountAdminEx] = User[id][accountAdmin];
5437 User[id][accountAdmin] = level;
5438
5439 if(level > 0)
5440 {
5441 if(!IsValidDynamic3DTextLabel(User[id][accountLabel]))
5442 User[id][accountLabel] = CreateDynamic3DTextLabel("_", -1, 0, 0, 0.30, 25, id, .testlos = 1);
5443
5444 UpdateDynamic3DTextLabelText(User[id][accountLabel], 0xFF0000FF, GetAdminRank(level));
5445 }
5446 else
5447 {
5448 DestroyDynamic3DTextLabel(User[id][accountLabel]);
5449 }
5450
5451 format(string, sizeof string, "Admin %s has set %s's administrative level to %d", pName(playerid), pName(id), level);
5452 SaveLog("account.txt", string);
5453
5454 SaveData(id); //Saving the whole data
5455 return 1;
5456}
5457
5458CMD:setlevel(playerid, params[])
5459{
5460 new string[128], id, level;
5461
5462 LoginCheck(playerid);
5463 LevelCheck(playerid, 5);
5464
5465 if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setlevel [playerid] [level(0/5)]");
5466 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5467 if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_RED, "* Levels shouldn't go below zero and shouldn't go above five.");
5468 if(level == User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* Player is already in that level.");
5469 if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
5470
5471 if(User[id][accountAdmin] < level)
5472 {
5473 format(string, 128, "You have been promoted to level %d by %s.", level, pName(playerid));
5474 SendClientMessage(id, COLOR_YELLOW, string);
5475 format(string, 128, "You have promoted %s to level %d.", pName(id), level);
5476 SendClientMessage(playerid, COLOR_YELLOW, string);
5477 }
5478 else if(User[id][accountAdmin] > level)
5479 {
5480 format(string, 128, "You have been demoted to level %d by %s.", level, pName(playerid));
5481 SendClientMessage(id, COLOR_YELLOW, string);
5482 format(string, 128, "You have demoted %s to level %d.", pName(id), level);
5483 SendClientMessage(playerid, COLOR_YELLOW, string);
5484 }
5485
5486 if(User[id][accountTemporary])
5487 {
5488 SendClientMessage(playerid, -1, "The effect of /settemplevel has been removed since you used /setlevel on this player.");
5489 }
5490 User[id][accountTemporary] = false;
5491 User[id][accountAdminEx] = 0;
5492 User[id][accountAdmin] = level;
5493
5494 format(string, sizeof string, "Admin %s has set %s's administrative level to %d", pName(playerid), pName(id), level);
5495 SaveLog("account.txt", string);
5496
5497 if(level > 0)
5498 {
5499 if(!IsValidDynamic3DTextLabel(User[id][accountLabel]))
5500 User[id][accountLabel] = CreateDynamic3DTextLabel("_", -1, 0, 0, 0.30, 25, id, .testlos = 1);
5501
5502 UpdateDynamic3DTextLabelText(User[id][accountLabel], 0xFF0000FF, GetAdminRank(level));
5503 }
5504 else
5505 {
5506 DestroyDynamic3DTextLabel(User[id][accountLabel]);
5507 }
5508
5509 SaveData(id); //Saving the whole data
5510 return 1;
5511}
5512
5513//============================================================================//
5514// Administrative Level Zero //
5515//============================================================================//
5516
5517CMD:id(playerid, params[])
5518{
5519 new name[MAX_PLAYER_NAME], string[128], count;
5520
5521 if (sscanf(params, "s[24]", name))
5522 return SendClientMessage(playerid, COLOR_RED, "USAGE: /id [name]");
5523
5524 foreach(new i : Player)
5525 {
5526 if(strfind(ReturnPlayerName(i), name, true) != -1)
5527 {
5528 format(string, sizeof (string), "%i. %s (ID: %d)", ++count, pName(i), i);
5529 SendClientMessage(playerid, COLOR_ADMIN, string);
5530 }
5531 }
5532
5533 if(!count)
5534 return SendClientMessage(playerid, COLOR_RED, "** No match found.");
5535 return 1;
5536}
5537
5538CMD:getid(playerid, params[]) return cmd_id(playerid, params);
5539
5540CMD:admins(playerid, params[])
5541{
5542 new count = 0, count2 = 0;
5543
5544 #if defined USE_DIALOG
5545 static string[128 * 10];
5546 string[0] = 0;
5547
5548 foreach(new i : Player)
5549 {
5550 if(User[i][accountLogged] && User[i][accountAdmin] >= 1)
5551 {
5552 if(!User[i][accountHide])
5553 {
5554 count++;
5555 format(string, sizeof(string), "%s"white"(%d) %s - %s %s\n", string, i, pName(i), GetAdminRank(User[i][accountAdmin]), (User[i][accountDuty]) ? (""green"(ADMIN DUTY)") : (""red"(PLAYING)"));
5556 }
5557 else count2++;
5558 }
5559 }
5560
5561 if(!count)
5562 return SendClientMessage(playerid, -1, "No Admins online at the server.");
5563
5564 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, "ADMINs", string, "CLOSE", "");
5565 #else
5566 static string[128];
5567 string[0] = 0;
5568
5569 SendClientMessage(playerid, COLOR_GREEN, "Administrators Online:");
5570 foreach(new i : Player)
5571 {
5572 if(User[i][accountLogged] && User[i][accountAdmin] >= 1)
5573 {
5574 if(!User[i][accountHide])
5575 {
5576 format(string, sizeof(string), "(%d) %s - %s %s\n", i, pName(i), GetAdminRank(User[i][accountAdmin]), (User[i][accountDuty]) ? (""green"(ADMIN DUTY)") : (""red"(PLAYING)"));
5577 SendClientMessage(playerid, -1, string);
5578 }
5579 else count2++;
5580 count++;
5581 }
5582 }
5583
5584 if(!count)
5585 return SendClientMessage(playerid, -1, "No Admins online at the server.");
5586 #endif
5587 return 1;
5588}
5589
5590CMD:jjjcredits(playerid, params[])
5591{
5592 SendClientMessage(playerid, COLOR_GREEN, "BS Administration System "VERSION" Credits to:");
5593 SendClientMessage(playerid, -1, "Jake_Hero, Y_Less, Zeex, Zher0, Lordzy, denNorske, Emmet_");
5594 SendClientMessage(playerid, COLOR_YELLOW, "{FF80FF}MillyTheQueen{FFFF00}, NotDunn, Kizuna, YaBoiJeff (Sean), Pavintharan, Uberanwar");
5595 SendClientMessage(playerid, COLOR_YELLOW, "Ranveer, Samp_India, Ashirwad, Sonic, Adham, MaxFranky and others who helped us.");
5596 return 1;
5597}
5598
5599CMD:savestats(playerid, params[])
5600{
5601 LoginCheck(playerid);
5602
5603 if(!DataExist(pName(playerid))) return SendClientMessage(playerid, COLOR_RED, "* You do not have account.");
5604
5605 SaveData(playerid);
5606
5607 SendClientMessage(playerid, COLOR_GREEN, "ACCOUNT: Your account statistics has been saved manually.");
5608 return 1;
5609}
5610
5611CMD:cquestion(playerid, params[])
5612{
5613 LoginCheck(playerid);
5614
5615 static hashpass[129];
5616 hashpass[0] = 0;
5617
5618 if(isnull(params))
5619 return SendClientMessage(playerid, COLOR_YELLOW, "* Input your password first before changing the security question, /cquestion [password]");
5620
5621 WP_Hash(hashpass, sizeof(hashpass), params);
5622 if(!strcmp(hashpass, User[playerid][accountPassword], false))
5623 {
5624 SendClientMessage(playerid, COLOR_GREEN, "* You are the owner of this account, You may pass through.");
5625 Dialog_Show(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""green"Security Question", ""grey"* Type in your new security question below;", "Set", "Cancel");
5626 }
5627 else
5628 {
5629 format(hashpass, sizeof(hashpass), "* %s isn't the password.", params);
5630 SendClientMessage(playerid, COLOR_YELLOW, hashpass);
5631 }
5632 return 1;
5633}
5634
5635CMD:togpm(playerid, params[])
5636{
5637 switch(User[playerid][accountPM])
5638 {
5639 case false:
5640 {
5641 SendClientMessage(playerid, COLOR_GREEN, "* You have togged on your private messages (You can now receive /pm's)");
5642 User[playerid][accountPM] = 1;
5643 }
5644 case true:
5645 {
5646 SendClientMessage(playerid, COLOR_RED, "* You have togged off your private messages (You won't receive /pm's)");
5647 User[playerid][accountPM] = 0;
5648 }
5649 }
5650 SaveData(playerid);
5651 return 1;
5652}
5653
5654CMD:pm(playerid, params[])
5655{
5656 LoginCheck(playerid);
5657
5658 new string[128], message[128], id;
5659
5660 if (!User[playerid][accountPM])
5661 return SendClientMessage(playerid, COLOR_RED, "* You have your PM togged.");
5662
5663 if (sscanf(params, "us[128]", id, message))
5664 return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm [playerid] [text]");
5665
5666 if (id == INVALID_PLAYER_ID)
5667 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5668
5669 if (!User[id][accountPM])
5670 return SendClientMessage(playerid, COLOR_RED, "* That player has their PM togged.");
5671
5672 PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
5673 PlayerPlaySound(id, 1085, 0.0, 0.0, 0.0);
5674
5675 format(string, sizeof(string), "* PM Sent to %s (ID: %d): %s", pName(id), id, message);
5676 SendClientMessage(playerid, 0x9ACD32AA, string);
5677 format(string, sizeof(string), "* PM From %s (ID: %d): %s", pName(playerid), playerid, message);
5678 SendClientMessage(id, 0x9ACD32AA, string);
5679
5680 CallRemoteFunction("OnPlayerPrivMessage", "dds", playerid, id, message);
5681
5682 if(ServerInfo[ReadPMs])
5683 {
5684 format(string, sizeof(string), "[PM] %s > %s: %s", pName(playerid), pName(id), message);
5685 printf("[PM] %s > %s: %s", pName(playerid), pName(id), message);
5686 foreach(new i : Player)
5687 {
5688 if(User[playerid][accountAdmin] > User[i][accountAdmin])
5689 {
5690 SendClientMessage(i, COLOR_GREEN, string);
5691 }
5692 }
5693 }
5694 return 1;
5695}
5696
5697CMD:givechocolate(playerid, params[])
5698{
5699 LoginCheck(playerid);
5700
5701 new string[128], id, amount;
5702
5703 if (sscanf(params, "ud", id, amount))
5704 return SendClientMessage(playerid, COLOR_RED, "USAGE: /givechocolate [playerid] [amount]");
5705
5706 if (id == INVALID_PLAYER_ID)
5707 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5708
5709 if (id == playerid)
5710 return SendClientMessage(playerid, COLOR_RED, "* You cannot give yourself a Chocolate.");
5711
5712 if (amount < 1 || amount > User[playerid][accountChocolate])
5713 return SendClientMessage(playerid, COLOR_RED, "* You cannot give below ZERO chocolates/or you don't have that much on you.");
5714
5715 User[playerid][accountChocolate] -= amount;
5716 User[id][accountChocolate] += amount;
5717
5718 format(string, sizeof(string), "* You have received %d chocolate bars from %s - You have now %d chocolate bars.", amount, pName(playerid), User[id][accountChocolate]);
5719 SendClientMessage(id, COLOR_GREEN, string);
5720 format(string, sizeof(string), "* You have given %d chocolate bars to %s - You have now %d chocolate bars.", amount, pName(id), User[playerid][accountChocolate]);
5721 SendClientMessage(playerid, -1, string);
5722 return 1;
5723}
5724
5725CMD:jjjcmds(playerid, params[])
5726{
5727 static string[1246];
5728 string[0] = 0;
5729
5730 LoginCheck(playerid);
5731
5732 strcat(string, ""green"");
5733 strcat(string, "Listing all available commands of BS\n\n");
5734
5735 strcat(string, ""grey"");
5736 strcat(string, "/stats /cpass /register /login /report /admins /credits /savestats /cquestion\n");
5737 strcat(string, "/votekick (/yes /no) /givechocolate /pm /togpm /id (getid)");
5738
5739 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""green"Player Commands", string, "Close", "");
5740 return 1;
5741}
5742
5743CMD:yes(playerid, params[])
5744{
5745 static string[128];
5746 string[0] = 0;
5747
5748 if(!VoteKickHappening)
5749 return SendClientMessage(playerid, COLOR_RED, "* There is no vote-kick happening right now.");
5750
5751 if(HasAlreadyVoted{playerid})
5752 return SendClientMessage(playerid, COLOR_RED, "* You have already voted!");
5753
5754 svotes++;
5755 HasAlreadyVoted{playerid} = true;
5756
5757 if(svotes < MaxVKICK)
5758 {
5759 format(string, sizeof(string), "VOTEKICK: %s has voted YES on getting %s kicked for %s. (%d/%d)", pName(playerid), pName(VoteKickTarget), VoteKickReason, svotes, MaxVKICK);
5760 SendClientMessageToAll(COLOR_GREEN, string);
5761 SaveLog("votekick.txt", string);
5762 }
5763 else if(svotes >= MaxVKICK)
5764 {
5765 format(string, sizeof(string), "VOTEKICK: The vote is a success and %s was kicked for %s.", pName(VoteKickTarget), VoteKickReason);
5766 SendClientMessageToAll(COLOR_ORANGE, string);
5767 SaveLog("votekick.txt", string);
5768
5769 KickDelay(VoteKickTarget);
5770
5771 format(VoteKickReason, sizeof(VoteKickReason), "None");
5772 VoteKickHappening = 0;
5773 avotes = 0;
5774 svotes = 0;
5775 VoteKickTarget = INVALID_PLAYER_ID;
5776 KillTimer(VoteTimer);
5777 //////////////////////
5778 foreach(new i : Player)
5779 {
5780 HasAlreadyVoted{i} = false;
5781 }
5782 }
5783 return 1;
5784}
5785
5786CMD:no(playerid, params[])
5787{
5788 static string[128];
5789 string[0] = 0;
5790
5791 if(!VoteKickHappening)
5792 return SendClientMessage(playerid, COLOR_RED, "* There is no vote-kick happening right now.");
5793
5794 if(HasAlreadyVoted{playerid})
5795 return SendClientMessage(playerid, COLOR_RED, "* You have already voted!");
5796
5797 if(avotes < MaxVKICK)
5798 {
5799 if(!avotes)
5800 return SendClientMessage(playerid, COLOR_RED, "* There aren't any players voting 'YES' on this vote-kick!");
5801
5802 avotes++;
5803 svotes--;
5804 HasAlreadyVoted{playerid} = true;
5805 format(string, sizeof(string), "VOTEKICK: %s has voted NO on getting %s kicked for %s. (%d/%d)", pName(playerid), pName(VoteKickTarget), VoteKickReason, svotes, MaxVKICK);
5806 SendClientMessageToAll(COLOR_GREEN, string);
5807 SaveLog("votekick.txt", string);
5808 }
5809 else if (avotes >= MaxVKICK)
5810 {
5811 format(string, sizeof(string), "VOTEKICK: The vote is a FAILURE and %s stays.", pName(VoteKickTarget));
5812 SendClientMessageToAll(COLOR_ORANGE, string);
5813 SaveLog("votekick.txt", string);
5814
5815 format(VoteKickReason, sizeof(VoteKickReason), "None");
5816 VoteKickHappening = 0;
5817 avotes = 0;
5818 svotes = 0;
5819 VoteKickTarget = INVALID_PLAYER_ID;
5820 KillTimer(VoteTimer);
5821 //////////////////////
5822 foreach(new i : Player)
5823 {
5824 HasAlreadyVoted{i} = false;
5825 }
5826 }
5827 return 1;
5828}
5829
5830CMD:votekick(playerid, params[])
5831{
5832 new count = 0, id, string[133], reason[64];
5833
5834 if(User[playerid][accountAdmin])
5835 return SendClientMessage(playerid, COLOR_RED, "* You are an admin, you can use your powers!");
5836
5837 if(GetPlayerPoolSize() < 3)
5838 return SendClientMessage(playerid, COLOR_RED, "* There needs to be 2 other players to use this command.");
5839
5840 if(VoteKickHappening)
5841 return SendClientMessage(playerid, COLOR_RED, "* There is a vote already happening, please wait for it to end!");
5842
5843 if(sscanf(params, "us[64]", id, reason))
5844 return SendClientMessage(playerid, COLOR_RED, "USAGE: /votekick [playerid] [reason]");
5845
5846 if(id == INVALID_PLAYER_ID)
5847 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5848
5849 if(id == playerid)
5850 return SendClientMessage(playerid, COLOR_RED, "* You cannot vote kick yourself.");
5851
5852 foreach(new i : Player) if(User[i][accountAdmin] >= 1)
5853 {
5854 count++;
5855 }
5856
5857 if(count)
5858 {
5859 format(string, sizeof(string), "* There are %d admins online, Admins has been notified about your vote-kick.", count);
5860 SendClientMessage(playerid, -1, string);
5861 format(string, sizeof(string), "[VOTE-KICK] Player %s wants to vote kick %s (ID: %d) for %s.", pName(playerid), pName(id), reason);
5862 SendAdmin(COLOR_YELLOW, string);
5863 SaveLog("votekick.txt", string);
5864 }
5865 else
5866 {
5867 format(string, sizeof(string), "[VOTEKICK] %s has started a vote on getting %s kicked (%s).", pName(playerid), pName(id), reason);
5868 SendClientMessageToAll(COLOR_RED, string);
5869 SaveLog("votekick.txt", string);
5870 format(string, sizeof(string), "** /yes or /no to vote | Vote Kick Limit: %d | Results to be released in: %d seconds", MaxVKICK);
5871 SendClientMessageToAll(COLOR_YELLOW, string);
5872 format(VoteKickReason, sizeof(VoteKickReason), reason);
5873 VoteKickTarget = id;
5874 VoteKickHappening = 1;
5875 VoteTimer = SetTimer("EndVoteKick", KickTime*1000, false);
5876 }
5877 return 1;
5878}
5879
5880CMD:report(playerid, params[])
5881{
5882 // Report has been re-worked on (01/27/17)
5883
5884 new id, reason[128];
5885
5886 if(User[playerid][accountAdmin] > 0)
5887 return SendClientMessage(playerid, COLOR_RED, "* You are already an admin, No need to /report.");
5888
5889 for(new c; c < MAX_REPORTS; c++)
5890 {
5891 if(rInfo[c][reportTaken])
5892 {
5893 if(rInfo[c][reporterID] == playerid)
5894 {
5895 if(rInfo[c][reportAccepted] == INVALID_PLAYER_ID)
5896 {
5897 format(reason, sizeof(reason), "* You have already reported someone earlier (%s (%s) - RID %d), The report is not being handled by anyone yet.", pName(rInfo[c][reportedID]), rInfo[c][reportReason], c);
5898 SendClientMessage(playerid, COLOR_YELLOW, reason);
5899 SendClientMessage(playerid, -1, "* /closereport to close your report.");
5900 }
5901 else
5902 {
5903 format(reason, sizeof(reason), "* You have already reported someone (%s (%s) - RID %d), The report is being handled by %s.", pName(rInfo[c][reportedID]), rInfo[c][reportReason], c, pName(rInfo[c][reportAccepted]));
5904 SendClientMessage(playerid, COLOR_YELLOW, reason);
5905 SendClientMessage(playerid, -1, "* Ask an admin to end your report if you wanted to end it.");
5906 }
5907 return 1;
5908 }
5909 }
5910 }
5911
5912 if(sscanf(params, "us[128]", id, reason))
5913 return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [playerid] [reason]");
5914
5915 if(strlen(reason) < 4 || strlen(reason) > 64)
5916 return SendClientMessage(playerid, COLOR_RED, "* Reason length shouldn't go lower than four and higher than sixty four.");
5917
5918 if(id == INVALID_PLAYER_ID)
5919 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
5920
5921 if(id == playerid)
5922 return SendClientMessage(playerid, COLOR_RED, "* You cannot report yourself.");
5923
5924 if(User[playerid][accountAdmin] < User[id][accountAdmin])
5925 return SendClientMessage(playerid, COLOR_RED, "* You cannot report an admin.");
5926
5927 InsertReport(playerid, id, reason);
5928 return 1;
5929}
5930
5931CMD:closereport(playerid, params[])
5932{
5933 static string[128];
5934 string[0] = 0;
5935
5936 for(new c; c < MAX_REPORTS; c++)
5937 {
5938 if(rInfo[c][reportTaken])
5939 {
5940 if(rInfo[c][reporterID] == playerid)
5941 {
5942 if(rInfo[c][reportAccepted] != INVALID_PLAYER_ID)
5943 return SendClientMessage(playerid, COLOR_RED, "** Your report is already being handled by an admin, too late to close it now.");
5944
5945 format(string, sizeof(string), "[Report] %s has decided to cancel their report against %s [Report ID: %d].", pName(playerid), pName(rInfo[c][reportedID]), c);
5946 SendAdmin(COLOR_GREEN, string);
5947
5948 ResetReport(c);
5949 return 1;
5950 }
5951 }
5952 }
5953 SendClientMessage(playerid, -1, "* You aren't reporting someone.");
5954 return 1;
5955}
5956
5957CMD:reporttalk(playerid, params[])
5958{
5959 static string[128];
5960 string[0] = 0;
5961
5962 if(isnull(params))
5963 return SendClientMessage(playerid, COLOR_RED, "USAGE: /reporttalk [message]");
5964
5965 if(User[playerid][accountAdmin] >= 1)
5966 {
5967 for(new i; i < MAX_REPORTS; i++)
5968 {
5969 if(rInfo[i][reportTaken] && rInfo[i][reporterID] == playerid && rInfo[i][reportAccepted] != INVALID_PLAYER_ID)
5970 {
5971 format(string, sizeof(string), "* To Admin %s: %s", pName(rInfo[i][reportAccepted]), params);
5972 SendClientMessage(playerid, -1, string);
5973 format(string, sizeof(string), "* %s said: %s", pName(playerid), params);
5974 SendClientMessage(rInfo[i][reportAccepted], -1, string);
5975 return 1;
5976 }
5977 if(rInfo[i][reportTaken] && rInfo[i][reportAccepted] == playerid)
5978 {
5979 format(string, sizeof(string), "* Talking to %s: %s", pName(rInfo[i][reporterID]), params);
5980 SendClientMessage(playerid, -1, string);
5981 format(string, sizeof(string), "* %s to you: %s", pName(playerid), params);
5982 SendClientMessage(rInfo[i][reporterID], -1, string);
5983 return 1;
5984 }
5985 }
5986 SendClientMessage(playerid, -1, "* You aren't handling any report.");
5987 }
5988 else
5989 {
5990 for(new i; i < MAX_REPORTS; i++)
5991 {
5992 if(rInfo[i][reportTaken] && rInfo[i][reporterID] == playerid && rInfo[i][reportAccepted] != INVALID_PLAYER_ID)
5993 {
5994 format(string, sizeof(string), "* To Admin %s: %s", pName(rInfo[i][reportAccepted]), params);
5995 SendClientMessage(playerid, -1, string);
5996 format(string, sizeof(string), "* %s said: %s", pName(playerid), params);
5997 SendClientMessage(rInfo[i][reportAccepted], -1, string);
5998 return 1;
5999 }
6000 }
6001 SendClientMessage(playerid, -1, "* You haven't reported someone or the report isn't accepted by an admin yet.");
6002 }
6003 return 1;
6004}
6005
6006CMD:register(playerid, params[])
6007{
6008 if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "* You are logged in and registered already.");
6009
6010 if(!DataExist(pName(playerid)))
6011 {
6012 new string[128], password[24], hashpass[129], oldname[24];
6013
6014 if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /register [password]");
6015 if(!IsValidPassword(password)) return SendClientMessage(playerid, COLOR_RED, "* Invalid Password Symbols.");
6016 if(strlen(password) < 4 || strlen(password) > 20) return SendClientMessage(playerid, COLOR_RED, "* Password length shouldn't go below 4 and shouldn't go higher 20.");
6017
6018 GetPVarString(playerid, "old_name", oldname, sizeof(oldname));
6019 if(!isnull(oldname))
6020 {
6021 SetPlayerName(playerid, oldname);
6022 format(string, sizeof(string), "* Your name has been reverted back to %s since you registered.", pName(playerid));
6023 SendClientMessage(playerid, -1, string);
6024 }
6025
6026 WP_Hash(hashpass, 129, password);
6027 RegisterPlayer(playerid, hashpass);
6028 }
6029 else
6030 {
6031 SendClientMessage(playerid, COLOR_RED, "* You already have an account, /login instead.");
6032 }
6033 return 1;
6034}
6035
6036CMD:login(playerid, params[])
6037{
6038 if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "* You are logged in already.");
6039
6040 if(DataExist(pName(playerid)))
6041 {
6042 static string[900];
6043 string[0] = 0;
6044 new hashp[129], password[24];
6045
6046 if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [password]");
6047
6048 if(strcmp(password, "forget", true) == 0)
6049 {
6050 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
6051 return SendClientMessage(playerid, COLOR_RED, "* You haven't set a security question & answer on your account.");
6052
6053 format(string, sizeof(string), "You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.", User[playerid][accountQuestion]);
6054 Dialog_Show(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""green"Security Question", string, "Answer", "Quit");
6055 return 1;
6056 }
6057
6058 WP_Hash(hashp, 129, password);
6059 if(!strcmp(hashp, User[playerid][accountPassword], false))
6060 {
6061 LoginPlayer(playerid);
6062 }
6063 else
6064 {
6065 User[playerid][WarnLog]++;
6066
6067 if(User[playerid][WarnLog] >= ServerInfo[LoginWarn])
6068 {
6069 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server having too much wrong passwords!\nTry again, Reconnect (/q then join to the server again.)", "Close", "");
6070 KickDelay(playerid);
6071 return 1;
6072 }
6073
6074 format(string, sizeof(string), "Invalid password! - %d out of %d Warning Log Tires.", User[playerid][WarnLog], ServerInfo[LoginWarn]);
6075 SendClientMessage(playerid, COLOR_RED, string);
6076 SendClientMessage(playerid, -1, "LOGIN: Try again, /login [password].");
6077 }
6078 }
6079 else
6080 {
6081 SendClientMessage(playerid, COLOR_RED, "* You do not have an account, /register first.");
6082 }
6083 return 1;
6084}
6085
6086CMD:cpass(playerid, params[])
6087{
6088 LoginCheck(playerid);
6089
6090 new OldPass[24], NewPass[24], string[128];
6091
6092 if(sscanf(params, "s[24]s[24]", OldPass, NewPass))
6093 return SendClientMessage(playerid, COLOR_RED, "USAGE: /cpass [old pass] [new pass]");
6094
6095 if(strlen(NewPass) < 4 || strlen(NewPass) > 20)
6096 return SendClientMessage(playerid, COLOR_RED, "* New password length shouldn't go below four and shouldn't go below twenty.");
6097
6098 new Query[300], DBResult:Result, Buf[129];
6099 WP_Hash(Buf, 129, OldPass);
6100 format(Query, 300, "SELECT `userid` FROM `users` WHERE `username` = '%s' AND `password` = '%s'", DB_Escape(User[playerid][accountName]), Buf);
6101 Result = db_query(Database, Query);
6102
6103 format(string, sizeof string, "Player %s has changed their password.", pName(playerid));
6104 SaveLog("account.txt", string);
6105
6106 if(db_num_rows(Result))
6107 {
6108 WP_Hash(Buf, 129, NewPass);
6109 format(User[playerid][accountPassword], 129, Buf);
6110 format(Query, 300, "UPDATE `users` SET `password` = '%s' WHERE `username` = '%s'", DB_Escape(Buf), DB_Escape(User[playerid][accountName]));
6111 db_query(Database, Query);
6112
6113 format(string, 128, "Your password has been changed to '"green"%s"white"'", NewPass);
6114 SendClientMessage(playerid, -1, string);
6115 }
6116 else SendClientMessage(playerid, COLOR_RED, "* Old Password doesn't match on the current password!");
6117 db_free_result(Result);
6118 return 1;
6119}
6120
6121CMD:stats(playerid, params[])
6122{
6123 LoginCheck(playerid);
6124
6125 new id;
6126 if(!sscanf(params, "u", id))
6127 {
6128 LevelCheck(playerid, 1);
6129
6130 if(id == INVALID_PLAYER_ID)
6131 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
6132
6133 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6134 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
6135
6136 ShowStatistics(playerid, id);
6137 }
6138 else
6139 {
6140 ShowStatistics(playerid, playerid); //Show the statistics to yourself.
6141 if(User[playerid][accountAdmin]) SendClientMessage(playerid, COLOR_RED, "USAGE: /stats [playerid]");
6142 }
6143 return 1;
6144}
6145
6146// //
6147//============================================================================//
6148
6149public OnPlayerStateChange(playerid, newstate, oldstate)
6150{
6151 new vehicleid = GetPlayerVehicleID(playerid);
6152
6153 if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
6154 {
6155 foreach(new x : Player)
6156 {
6157 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE)
6158 {
6159 TogglePlayerSpectating(x, 1);
6160 PlayerSpectatePlayer(x, playerid);
6161 User[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
6162 }
6163 }
6164 }
6165
6166 if(newstate == PLAYER_STATE_PASSENGER)
6167 {
6168 foreach(new x : Player)
6169 {
6170 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
6171 {
6172 TogglePlayerSpectating(x, 1);
6173 PlayerSpectateVehicle(x, vehicleid);
6174 User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
6175 }
6176 }
6177 }
6178
6179 if(newstate == PLAYER_STATE_DRIVER)
6180 {
6181 foreach(new x : Player)
6182 {
6183 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
6184 {
6185 TogglePlayerSpectating(x, 1);
6186 PlayerSpectateVehicle(x, vehicleid);
6187 User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
6188 }
6189 }
6190
6191 RepairVehicle(GetPlayerVehicleID(playerid));
6192 UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), 0, 0, 0, 0);
6193 SetVehicleHealth(GetPlayerVehicleID(playerid), Float:0x7F800000);
6194 }
6195 return 1;
6196}
6197
6198public OnPlayerRequestSpawn(playerid)
6199{
6200 if(!User[playerid][accountLogged])
6201 {
6202 if(!ServerInfo[RegisterOption])
6203 {
6204 SendClientMessage(playerid, COLOR_RED, "* You need to login or register to spawn.");
6205 return 0;
6206 }
6207 else
6208 {
6209 if(!CheckAccount(pName(playerid)))
6210 {
6211 #if !defined USE_DIALOG
6212 new string[128];
6213 SetPVarString(playerid, "old_name", pName(playerid));
6214 format(string, sizeof(string), "%s_%d", pName(playerid), (random(10000) + 1));
6215 SetPlayerName(playerid, string);
6216 format(string, sizeof(string), "* You have skipped the registration, resulting on your name to be set to %s.", pName(playerid));
6217 SendClientMessage(playerid, COLOR_RED, string);
6218 SendClientMessage(playerid, COLOR_GREEN, "* Signing-up your account will set your name back to normal.");
6219 #endif
6220 return 1;
6221 }
6222 else
6223 {
6224 SendClientMessage(playerid, COLOR_RED, "* You need to login to spawn.");
6225 return 0;
6226 }
6227 }
6228 }
6229 return 1;
6230}
6231
6232public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
6233{
6234 foreach(new x : Player)
6235 {
6236 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
6237 {
6238 SetPlayerInterior(x,newinteriorid);
6239 }
6240 }
6241 return 1;
6242}
6243
6244public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
6245{
6246 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
6247 {
6248 if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
6249 else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
6250 }
6251 return 1;
6252}
6253
6254#if defined USE_RCON_PROTECTION
6255 public OnPlayerRconLogin(playerid)
6256 {
6257 if(_RCON[playerid] == false)
6258 {
6259 SendClientMessage(playerid, COLOR_YELLOW, "* This server uses a second RCON protection to guard off against hackers.");
6260 Dialog_Show(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by the server.\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
6261 }
6262 return 1;
6263 }
6264#endif
6265
6266//============================================================================//
6267Dialog:DIALOG_BEGIN(playerid, response, listitem, inputtext[])
6268{
6269 playerid = INVALID_PLAYER_ID;
6270 response = 0;
6271 listitem = 0;
6272 inputtext[0] = '\0';
6273}
6274
6275#if defined USE_RCON_PROTECTION
6276Dialog:DIALOG_RCON(playerid, response, listitem, inputtext[])
6277{
6278 static string[128];
6279 string[0] = 0;
6280
6281 if(!response)
6282 {
6283 format(string, sizeof(string), "** %s was kicked from the server (attempted login to RCON)", pName(playerid));
6284 SendClientMessageToAll(COLOR_RED, string);
6285 print(string);
6286 SaveLog("rcon.txt", string);
6287 return KickDelay(playerid);
6288 }
6289 else
6290 {
6291 if(!strcmp(RCON_PASSWORD, inputtext, true))
6292 {
6293 format(string, sizeof(string), "[RCON] %s (%s) logged into the RCON.", pName(playerid), User[playerid][accountIP]);
6294 SendAdmin(COLOR_RED, string);
6295 print(string);
6296 SaveLog("rcon.txt", string);
6297
6298 _RCON[playerid] = true;
6299
6300 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~g~Authorized ~w~Access!~n~~y~Welcome Admin!", 3000, 3);
6301 }
6302 else
6303 {
6304 if(_RCONwarn[playerid] >= MAX_RCON_WARNINGS+1)
6305 {
6306 format(string, sizeof(string), "** %s was kicked from the server (attempted login to RCON)", pName(playerid));
6307 SendClientMessageToAll(COLOR_RED, string);
6308 print(string);
6309 SaveLog("kicklog.txt", string);
6310 KickDelay(playerid);
6311 return 1;
6312 }
6313 _RCONwarn[playerid] ++;
6314 format(string, sizeof(string), "You have been warned for incorrect RCON password login (Warnings: %i/%i)", _RCONwarn[playerid], MAX_RCON_WARNINGS);
6315 SendClientMessage(playerid, COLOR_RED, string);
6316 Dialog_Show(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by the server.\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
6317 }
6318 }
6319 return 1;
6320}
6321#endif
6322
6323Dialog:DIALOG_PUNISHMENT(playerid, response, listitem, inputtext[])
6324{
6325 static string[128];
6326 string[0] = 0;
6327 new id = GetPVarInt(playerid, "punish_clicked"), Float:x, Float:y, Float:z;
6328 if(response)
6329 {
6330 if(!strcmp(inputtext, "Report this player"))
6331 {
6332 if(User[playerid][accountAdmin] < 1)
6333 {
6334 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6335 return SendClientMessage(playerid, COLOR_RED, "* You cannot report this player, they are an admin.");
6336
6337 SetPVarInt(playerid, "punish_type", 7);
6338 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Report Reason", "What this player has violated?", "Report", "Cancel");
6339 }
6340 else SendClientMessage(playerid, COLOR_RED, "* You are an admin, you do not need this - dialog operation has been cancelled.");
6341 }
6342 if(!strcmp(inputtext, "Kick", true))
6343 {
6344 if(User[playerid][accountAdmin] >= 1)
6345 {
6346 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6347 return SendClientMessage(playerid, COLOR_RED, "* You cannot kick this player, they are a higher admin.");
6348
6349 SetPVarInt(playerid, "punish_type", 1);
6350 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Kick:", "Input the reason why this user should be kicked:", "Execute", "Cancel");
6351 }
6352 else SendClientMessage(playerid, COLOR_RED, "* You are no longer an admin therefore the dialog operation has been cancelled.");
6353 }
6354 if(!strcmp(inputtext, "Teleport to this player", true))
6355 {
6356 GetPlayerPos(id, x, y, z);
6357 SetPlayerInterior(playerid, GetPlayerInterior(id));
6358 SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
6359 if(GetPlayerState(playerid) == 2)
6360 {
6361 SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
6362 LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
6363 SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
6364 }
6365 else SetPlayerPos(playerid, x+2, y, z);
6366
6367 format(string, sizeof(string), "You have been teleported to Player %s.", pName(id));
6368 SendClientMessage(playerid, COLOR_GREEN, string);
6369 format(string, sizeof(string), "Admin %s has teleported to your location.", pName(playerid));
6370 SendClientMessage(id, COLOR_GREEN, string);
6371 DeletePVar(playerid, "punish_clicked");
6372 }
6373 if(!strcmp(inputtext, "Respawn", true))
6374 {
6375 if(User[playerid][accountAdmin] >= 1)
6376 {
6377 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6378 return SendClientMessage(playerid, COLOR_RED, "* You cannot respawn this player, they are a higher admin.");
6379
6380 SetPlayerPos(id, 0.0, 0.0, 0.0);
6381 SpawnPlayer(id);
6382 format(string, sizeof(string), "You have respawned Player %s.", pName(id));
6383 SendClientMessage(playerid, -1, string);
6384 format(string, sizeof(string), "Admin %s has respawned you.", pName(playerid));
6385 SendClientMessage(id, COLOR_YELLOW, string);
6386 DeletePVar(playerid, "punish_clicked");
6387 }
6388 else SendClientMessage(playerid, COLOR_RED, "* You are no longer an admin therefore the dialog operation has been cancelled.");
6389 }
6390 if(!strcmp(inputtext, "Warn", true))
6391 {
6392 if(User[playerid][accountAdmin] >= 1)
6393 {
6394 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6395 return SendClientMessage(playerid, COLOR_RED, "* You cannot warn this player, they are a higher admin.");
6396
6397 SetPVarInt(playerid, "punish_type", 2);
6398 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Warning:", "Input the reason why this user should be warned:", "Execute", "Cancel");
6399 }
6400 else SendClientMessage(playerid, COLOR_RED, "* You are no longer an admin therefore the dialog operation has been cancelled.");
6401 }
6402 if(!strcmp(inputtext, "Explode", true))
6403 {
6404 if(User[playerid][accountAdmin] >= 2)
6405 {
6406 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6407 return SendClientMessage(playerid, COLOR_RED, "* You cannot explode this player, they are a higher admin.");
6408
6409 SetPVarInt(playerid, "punish_type", 3);
6410 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Explode:", "Input the reason why this user should be exploded:", "Execute", "Cancel");
6411 }
6412 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 2 admin therefore the dialog operation has been cancelled.");
6413 }
6414 if(!strcmp(inputtext, "Kill this player", true))
6415 {
6416 if(User[playerid][accountAdmin] >= 2)
6417 {
6418 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6419 return SendClientMessage(playerid, COLOR_RED, "* You cannot admin-kill this player, they are a higher admin.");
6420
6421 SetPVarInt(playerid, "punish_type", 4);
6422 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Kill:", "Input the reason why this user should be Admin-Killed:", "Execute", "Cancel");
6423 }
6424 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 2 admin therefore the dialog operation has been cancelled.");
6425 }
6426 if(!strcmp(inputtext, "Spectate", true))
6427 {
6428 if(User[playerid][accountAdmin] >= 2)
6429 {
6430 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6431 return SendClientMessage(playerid, COLOR_RED, "* You cannot spectate this player, they are a higher admin.");
6432
6433 if(GetPlayerState(id) == PLAYER_STATE_SPECTATING && User[id][SpecID] != INVALID_PLAYER_ID)
6434 return SendClientMessage(playerid, COLOR_RED, "* Player is spectating someone.");
6435
6436 if(GetPlayerState(id) != 1 && GetPlayerState(id) != 2 && GetPlayerState(id) != 3)
6437 return SendClientMessage(playerid, COLOR_RED, "* Player not spawned.");
6438
6439 GetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
6440 GetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
6441 SpecInt[playerid][0] = GetPlayerInterior(playerid);
6442 SpecInt[playerid][1] = GetPlayerVirtualWorld(playerid);
6443 StartSpectate(playerid, id);
6444 format(string, sizeof(string), "Now Spectating: %s (ID: %d)", pName(id), id);
6445 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
6446 SendClientMessage(playerid, -1, "Press SHIFT for Advance Spectating and SPACE for backward spectating.");
6447 DeletePVar(playerid, "punish_clicked");
6448 }
6449 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 2 admin therefore the dialog operation has been cancelled.");
6450 }
6451 if(!strcmp(inputtext, "Jetpack", true))
6452 {
6453 if(User[playerid][accountAdmin] >= 2)
6454 {
6455 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6456 return SendClientMessage(playerid, COLOR_RED, "* You cannot give this player a jetpack, they are a higher admin.");
6457
6458 SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
6459 format(string, sizeof(string), "You have given Player %s(ID:%d) a jetpack.", pName(id), id);
6460 SendClientMessage(playerid, COLOR_YELLOW, string);
6461 format(string, sizeof(string), "Admin %s(ID:%d) has given you a jetpack.", pName(playerid), playerid);
6462 SendClientMessage(id, COLOR_YELLOW, string);
6463 DeletePVar(playerid, "punish_clicked");
6464 }
6465 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 2 admin therefore the dialog operation has been cancelled.");
6466 }
6467 if(!strcmp(inputtext, "Slap", true))
6468 {
6469 if(User[playerid][accountAdmin] >= 3)
6470 {
6471 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6472 return SendClientMessage(playerid, COLOR_RED, "* You cannot slap this player, they are a higher admin.");
6473
6474 SetPVarInt(playerid, "punish_type", 5);
6475 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Slap:", "Input the reason why this user should be slapped:", "Execute", "Cancel");
6476 }
6477 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 3 admin therefore the dialog operation has been cancelled.");
6478 }
6479 if(!strcmp(inputtext, "Smash the Hammer", true))
6480 {
6481 if(User[playerid][accountAdmin] >= 3)
6482 {
6483 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6484 return SendClientMessage(playerid, COLOR_RED, "* You cannot ban this player, they are a higher admin.");
6485
6486 SetPVarInt(playerid, "punish_type", 6);
6487 Dialog_Show(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT, "Reason for Ban:", "Input the reason why this user should be banned:", "Execute", "Cancel");
6488 }
6489 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 3 admin therefore the dialog operation has been cancelled.");
6490 }
6491 if(!strcmp(inputtext, "Teleport player to you", true))
6492 {
6493 if(User[playerid][accountAdmin] >= 3)
6494 {
6495 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6496 return SendClientMessage(playerid, COLOR_RED, "* You cannot teleport this player to you, they are a higher admin.");
6497
6498 GetPlayerPos(playerid, x, y, z);
6499 SetPlayerInterior(id, GetPlayerInterior(playerid));
6500 SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
6501
6502 if(GetPlayerState(id) == 2)
6503 {
6504 new VehicleID = GetPlayerVehicleID(id);
6505 SetVehiclePos(VehicleID, x+3, y, z);
6506 LinkVehicleToInterior(VehicleID, GetPlayerInterior(playerid));
6507 SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(playerid));
6508 }
6509 else SetPlayerPos(id, x+2, y, z);
6510
6511 format(string, sizeof(string), "You have been teleported to Admin %s(ID:%d) location.", pName(playerid), playerid);
6512 SendClientMessage(id, COLOR_YELLOW, string);
6513 format(string, sizeof(string), "You have teleported %s(ID:%d) to your location.", pName(id), id);
6514 SendClientMessage(playerid, COLOR_YELLOW, string);
6515
6516 DeletePVar(playerid, "punish_clicked");
6517 }
6518 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 3 admin therefore the dialog operation has been cancelled.");
6519 }
6520 if(!strcmp(inputtext, "Crash their game", true))
6521 {
6522 if(User[playerid][accountAdmin] >= 3)
6523 {
6524 if(User[playerid][accountAdmin] < User[id][accountAdmin])
6525 return SendClientMessage(playerid, COLOR_RED, "* You cannot crash this player's game, they are a higher admin.");
6526
6527 format(string, sizeof(string), "You crashed Player %s (ID: %d).", pName(id), id);
6528 SendClientMessage(playerid, -1, string);
6529 format(string, sizeof(string), "Admin %s has crashed your game.", pName(playerid));
6530 SendClientMessage(id, COLOR_YELLOW, string);
6531
6532 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
6533 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
6534 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
6535 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
6536 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
6537 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
6538 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
6539
6540 DeletePVar(playerid, "punish_clicked");
6541 }
6542 else SendClientMessage(playerid, COLOR_RED, "* You are no longer a level 3 admin therefore the dialog operation has been cancelled.");
6543 }
6544 }
6545 else
6546 {
6547 DeletePVar(playerid, "punish_clicked");
6548 DeletePVar(playerid, "punish_type");
6549 }
6550 return 1;
6551}
6552
6553Dialog:DIALOG_REASON(playerid, response, listitem, inputtext[])
6554{
6555 static string[128];
6556 string[0] = 0;
6557 new type = GetPVarInt(playerid, "punish_type"), id = GetPVarInt(playerid, "punish_clicked");
6558 if(response)
6559 {
6560 if(!strlen(inputtext))
6561 {
6562 SendClientMessage(playerid, COLOR_RED, "Dialog operation cancelled, No input were typed in the field.");
6563 return 1;
6564 }
6565
6566 switch(type)
6567 {
6568 case 1: // Kick
6569 {
6570 if(!IsPlayerConnected(id))
6571 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6572
6573 format(string, sizeof(string), "ADMIN: %s was kicked from the server by %s (Reason: %s)", pName(id), pName(playerid), inputtext);
6574 SendClientMessageToAll(COLOR_RED, string);
6575 SaveLog("kicklog.txt", string);
6576 KickDelay(id);
6577 DeletePVar(playerid, "punish_clicked");
6578 DeletePVar(playerid, "punish_type");
6579 }
6580 case 2: // Warn
6581 {
6582 if(!IsPlayerConnected(id))
6583 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6584
6585 User[id][accountWarn] += 1;
6586 format(string, sizeof(string), "Admin %s(%d) warned %s(%d) for %s (Warnings: %d)", pName(playerid), playerid, pName(id), id, inputtext, User[id][accountWarn]);
6587 SendClientMessageToAll(COLOR_YELLOW, string);
6588 }
6589 case 3: // Explode
6590 {
6591 if(!IsPlayerConnected(id))
6592 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6593
6594 new Float:x, Float:y, Float:z;
6595 GetPlayerPos(id, x, y, z);
6596 format(string, sizeof(string), "ADMIN: %s was exploded by %s (Reason: %s)", pName(id), pName(playerid), inputtext);
6597 SendClientMessageToAll(COLOR_RED, string);
6598 SaveLog("explode.txt", string);
6599 CreateExplosionForPlayer(id, x, y, z, 7, 1.00);
6600 }
6601 case 4: // Admin-Kill
6602 {
6603 if(!IsPlayerConnected(id))
6604 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6605
6606 SetPlayerHealth(id, 0.0);
6607 format(string, sizeof(string), "ADMIN: %s was killed by %s. (Reason: %s)", pName(id), pName(playerid), inputtext);
6608 SendClientMessageToAll(COLOR_RED, string);
6609 }
6610 case 5: // Slap
6611 {
6612 if(!IsPlayerConnected(id))
6613 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6614
6615 new Float:x, Float:y, Float:z, Float:health;
6616 GetPlayerPos(id, x, y, z);
6617 GetPlayerHealth(id, health);
6618 SetPlayerHealth(id, health-25);
6619 SetPlayerPos(id, x, y, z+5);
6620 PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
6621 PlayerPlaySound(id, 1190, 0.0, 0.0, 0.0);
6622 format(string, sizeof(string), "ADMIN: %s was slapped by %s. (Reason: %s)", pName(id), pName(playerid), inputtext);
6623 SendClientMessageToAll(COLOR_GREY, string);
6624 }
6625 case 6: // Smash the Hammer
6626 {
6627 if(!IsPlayerConnected(id))
6628 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6629
6630 new when[128], ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years;
6631 gettime(ban_hr, ban_min, ban_sec);
6632 getdate(ban_years, ban_month, ban_days);
6633 format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
6634 format(string, sizeof(string), "ADMIN: %s was banned by %s (Reason: %s)", pName(id), pName(playerid), inputtext);
6635 SendClientMessageToAll(COLOR_GREY, string);
6636 printf(string);
6637 SaveLog("banlog.txt", string);
6638 format(string, sizeof(string), "You have banned %s(%d) for %s.", pName(id), id, inputtext);
6639 SendClientMessage(playerid, COLOR_YELLOW, string);
6640 format(string, sizeof(string), "You have been banned by Admin %s(%d) (Reason: %s)", pName(playerid), playerid, inputtext);
6641 SendClientMessage(id, COLOR_YELLOW, string);
6642 BanAccount(id, pName(playerid), inputtext);
6643 for(new i; i < 100; i++) SendClientMessage(playerid, -1, " ");
6644 ShowBan(id, GetPVarInt(id, "ban_id"), pName(playerid), inputtext, when);
6645 KickDelay(id);
6646 }
6647 case 7: // Report this player
6648 {
6649 if(!IsPlayerConnected(id))
6650 return SendClientMessage(playerid, COLOR_RED, "* Player is no longer in game.");
6651
6652 InsertReport(playerid, id, inputtext);
6653 }
6654 }
6655 }
6656 else
6657 {
6658 DeletePVar(playerid, "punish_clicked");
6659 DeletePVar(playerid, "punish_type");
6660 }
6661 return 1;
6662}
6663
6664Dialog:DIALOG_AFK(playerid, response, listitem, inputtext[])
6665{
6666 static string[128];
6667 string[0] = 0;
6668
6669 if(response)
6670 {
6671 if(!strlen(inputtext))
6672 return Dialog_Show(playerid, DIALOG_AFK, DIALOG_STYLE_INPUT, "Idle Seconds", "Place in the maximum time the player can idle to. (0 to disable)", "Set", "Back");
6673
6674 if(!isnumeric(inputtext))
6675 return Dialog_Show(playerid, DIALOG_AFK, DIALOG_STYLE_INPUT, "Idle Seconds", "Place in the maximum time the player can idle to. (0 to disable)", "Set", "Back");
6676
6677 if(strval(inputtext) < 0)
6678 return Dialog_Show(playerid, DIALOG_AFK, DIALOG_STYLE_INPUT, "Idle Seconds", "Place in the maximum time the player can idle to. (0 to disable)", "Set", "Back");
6679
6680 ServerInfo[AFKTime] = strval(inputtext);
6681 SaveConfig();
6682
6683 format(string, sizeof(string), "* Admin %s has set the Time Limit for Idled Players to (%d).", pName(playerid), ServerInfo[AFKTime]);
6684 SendAdmin(COLOR_YELLOW, string);
6685 }
6686 else ShowSettings(playerid);
6687 return 1;
6688}
6689
6690Dialog:DIALOG_TABBED(playerid, response, listitem, inputtext[])
6691{
6692 static string[128];
6693 string[0] = 0;
6694
6695 if(response)
6696 {
6697 if(!strlen(inputtext))
6698 return Dialog_Show(playerid, DIALOG_TABBED, DIALOG_STYLE_INPUT, "Tabbed Seconds", "Place in the maximum time the player can alt-tab to. (0 to disable)", "Set", "Back");
6699
6700 if(!isnumeric(inputtext))
6701 return Dialog_Show(playerid, DIALOG_TABBED, DIALOG_STYLE_INPUT, "Tabbed Seconds", "Place in the maximum time the player can alt-tab to. (0 to disable)", "Set", "Back");
6702
6703 if(strval(inputtext) < 0)
6704 return Dialog_Show(playerid, DIALOG_TABBED, DIALOG_STYLE_INPUT, "Tabbed Seconds", "Place in the maximum time the player can alt-tab to. (0 to disable)", "Set", "Back");
6705
6706 ServerInfo[TabTime] = strval(inputtext);
6707 SaveConfig();
6708
6709 format(string, sizeof(string), "* Admin %s has set the Time Limit for Alt-Tabbed Players to (%d).", pName(playerid), ServerInfo[TabTime]);
6710 SendAdmin(COLOR_YELLOW, string);
6711 }
6712 else ShowSettings(playerid);
6713 return 1;
6714}
6715
6716Dialog:DIALOG_PING(playerid, response, listitem, inputtext[])
6717{
6718 static string[128];
6719 string[0] = 0;
6720
6721 if(response)
6722 {
6723 if(!strlen(inputtext))
6724 return Dialog_Show(playerid, DIALOG_PING, DIALOG_STYLE_INPUT, "Maximum Ping", "Place in the maximum ping in the server (E.G.; 1000);\n* Once player reached this ping, they will get warned first then kick.\n\n* To disable the Ping Kicker, simply place 0.", "Set", "Back");
6725
6726 if(!isnumeric(inputtext))
6727 return Dialog_Show(playerid, DIALOG_PING, DIALOG_STYLE_INPUT, "Maximum Ping", "Place in the maximum ping in the server (E.G.; 1000);\n* Once player reached this ping, they will get warned first then kick.\n\n* To disable the Ping Kicker, simply place 0.", "Set", "Back");
6728
6729 if(strval(inputtext) < 0)
6730 return Dialog_Show(playerid, DIALOG_PING, DIALOG_STYLE_INPUT, "Maximum Ping", "Place in the maximum ping in the server (E.G.; 1000);\n* Once player reached this ping, they will get warned first then kick.\n\n* To disable the Ping Kicker, simply place 0.", "Set", "Back");
6731
6732 ServerInfo[MaxPing] = strval(inputtext);
6733 SaveConfig();
6734
6735 format(string, sizeof(string), "* Admin %s has set the Maximum Ping to (%d).", pName(playerid), ServerInfo[MaxPing]);
6736 SendAdmin(COLOR_YELLOW, string);
6737 }
6738 else ShowSettings(playerid);
6739 return 1;
6740}
6741
6742Dialog:DIALOG_LOG_TRIES(playerid, response, listitem, inputtext[])
6743{
6744 static string[128];
6745 string[0] = 0;
6746
6747 if(response)
6748 {
6749 if(!strlen(inputtext))
6750 return Dialog_Show(playerid, DIALOG_LOG_TRIES, DIALOG_STYLE_INPUT, "Login Tries", "Place in the amount of maximum login tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6751
6752 if(!isnumeric(inputtext))
6753 return Dialog_Show(playerid, DIALOG_LOG_TRIES, DIALOG_STYLE_INPUT, "Login Tries", "Place in the amount of maximum login tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6754
6755 if(strval(inputtext) < 1)
6756 return Dialog_Show(playerid, DIALOG_LOG_TRIES, DIALOG_STYLE_INPUT, "Login Tries", "Place in the amount of maximum login tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6757
6758 ServerInfo[LoginWarn] = strval(inputtext);
6759 SaveConfig();
6760
6761 format(string, sizeof(string), "* Admin %s has set the Maximum Login Tries to (%d).", pName(playerid), ServerInfo[LoginWarn]);
6762 SendAdmin(COLOR_YELLOW, string);
6763 }
6764 else ShowSettings(playerid);
6765 return 1;
6766}
6767
6768Dialog:DIALOG_SEC_TRIES(playerid, response, listitem, inputtext[])
6769{
6770 static string[128];
6771 string[0] = 0;
6772
6773 if(response)
6774 {
6775 if(!strlen(inputtext))
6776 return Dialog_Show(playerid, DIALOG_SEC_TRIES, DIALOG_STYLE_INPUT, "Secure Tries", "Place in the amount of maximum security question tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6777
6778 if(!isnumeric(inputtext))
6779 return Dialog_Show(playerid, DIALOG_SEC_TRIES, DIALOG_STYLE_INPUT, "Secure Tries", "Place in the amount of maximum security question tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6780
6781 if(strval(inputtext) < 1)
6782 return Dialog_Show(playerid, DIALOG_SEC_TRIES, DIALOG_STYLE_INPUT, "Secure Tries", "Place in the amount of maximum security question tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6783
6784 ServerInfo[SecureWarn] = strval(inputtext);
6785 SaveConfig();
6786
6787 format(string, sizeof(string), "* Admin %s has set the Maximum Security Question Tries to (%d).", pName(playerid), ServerInfo[SecureWarn]);
6788 SendAdmin(COLOR_YELLOW, string);
6789 }
6790 else ShowSettings(playerid);
6791 return 1;
6792}
6793
6794Dialog:DIALOG_RANKS(playerid, response, listitem, inputtext[])
6795{
6796 if(response)
6797 {
6798 switch(listitem)
6799 {
6800 case 0: Dialog_Show(playerid, DIALOG_EDIT_ADMIN_1, DIALOG_STYLE_INPUT, "Editing; Admin Rank 1", "You are now editing Admin Rank #1;\n\n* Type in the new rank name for admin level 1.", "Set", "Back");
6801 case 1: Dialog_Show(playerid, DIALOG_EDIT_ADMIN_2, DIALOG_STYLE_INPUT, "Editing; Admin Rank 2", "You are now editing Admin Rank #2;\n\n* Type in the new rank name for admin level 2.", "Set", "Back");
6802 case 2: Dialog_Show(playerid, DIALOG_EDIT_ADMIN_3, DIALOG_STYLE_INPUT, "Editing; Admin Rank 3", "You are now editing Admin Rank #3;\n\n* Type in the new rank name for admin level 3.", "Set", "Back");
6803 case 3: Dialog_Show(playerid, DIALOG_EDIT_ADMIN_4, DIALOG_STYLE_INPUT, "Editing; Admin Rank 4", "You are now editing Admin Rank #4;\n\n* Type in the new rank name for admin level 4.", "Set", "Back");
6804 case 4: Dialog_Show(playerid, DIALOG_EDIT_ADMIN_5, DIALOG_STYLE_INPUT, "Editing; Admin Rank 5", "You are now editing Admin Rank #5;\n\n* Type in the new rank name for admin level 5.", "Set", "Back");
6805 }
6806 }
6807 else ShowSettings(playerid);
6808 return 1;
6809}
6810
6811Dialog:DIALOG_EDIT_ADMIN_1(playerid, response, listitem, inputtext[])
6812{
6813 if(response)
6814 {
6815 if(!strlen(inputtext))
6816 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_1, DIALOG_STYLE_INPUT, "Editing; Admin Rank 1", "You are now editing Admin Rank #1;\n\n* Type in the new rank name for admin level 1.", "Set", "Back");
6817
6818 if(strlen(inputtext) > 63)
6819 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_1, DIALOG_STYLE_INPUT, "Editing; Admin Rank 1", "You are now editing Admin Rank #1;\n\n* Type in the new rank name for admin level 1.", "Set", "Back");
6820
6821 format(ServerInfo[AdminRank1], 32, inputtext);
6822 SaveConfig();
6823 ShowRanks(playerid);
6824 }
6825 else ShowRanks(playerid);
6826 return 1;
6827}
6828
6829Dialog:DIALOG_EDIT_ADMIN_2(playerid, response, listitem, inputtext[])
6830{
6831 if(response)
6832 {
6833 if(!strlen(inputtext))
6834 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_2, DIALOG_STYLE_INPUT, "Editing; Admin Rank 2", "You are now editing Admin Rank #2;\n\n* Type in the new rank name for admin level 2.", "Set", "Back");
6835
6836 if(strlen(inputtext) > 63)
6837 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_2, DIALOG_STYLE_INPUT, "Editing; Admin Rank 2", "You are now editing Admin Rank #2;\n\n* Type in the new rank name for admin level 2.", "Set", "Back");
6838
6839 format(ServerInfo[AdminRank2], 32, inputtext);
6840 SaveConfig();
6841 ShowRanks(playerid);
6842 }
6843 else ShowRanks(playerid);
6844 return 1;
6845}
6846
6847Dialog:DIALOG_EDIT_ADMIN_3(playerid, response, listitem, inputtext[])
6848{
6849 if(response)
6850 {
6851 if(!strlen(inputtext))
6852 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_3, DIALOG_STYLE_INPUT, "Editing; Admin Rank 3", "You are now editing Admin Rank #3;\n\n* Type in the new rank name for admin level 3.", "Set", "Back");
6853
6854 if(strlen(inputtext) > 63)
6855 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_3, DIALOG_STYLE_INPUT, "Editing; Admin Rank 3", "You are now editing Admin Rank #3;\n\n* Type in the new rank name for admin level 3.", "Set", "Back");
6856
6857 format(ServerInfo[AdminRank3], 32, inputtext);
6858 SaveConfig();
6859 ShowRanks(playerid);
6860 }
6861 else ShowRanks(playerid);
6862 return 1;
6863}
6864
6865Dialog:DIALOG_EDIT_ADMIN_4(playerid, response, listitem, inputtext[])
6866{
6867 if(response)
6868 {
6869 if(!strlen(inputtext))
6870 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_4, DIALOG_STYLE_INPUT, "Editing; Admin Rank 4", "You are now editing Admin Rank #4;\n\n* Type in the new rank name for admin level 4.", "Set", "Back");
6871
6872 if(strlen(inputtext) > 63)
6873 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_4, DIALOG_STYLE_INPUT, "Editing; Admin Rank 4", "You are now editing Admin Rank #4;\n\n* Type in the new rank name for admin level 4.", "Set", "Back");
6874
6875 format(ServerInfo[AdminRank4], 32, inputtext);
6876 SaveConfig();
6877 ShowRanks(playerid);
6878 }
6879 else ShowRanks(playerid);
6880 return 1;
6881}
6882
6883Dialog:DIALOG_EDIT_ADMIN_5(playerid, response, listitem, inputtext[])
6884{
6885 if(response)
6886 {
6887 if(!strlen(inputtext))
6888 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_5, DIALOG_STYLE_INPUT, "Editing; Admin Rank 5", "You are now editing Admin Rank #5;\n\n* Type in the new rank name for admin level 5.", "Set", "Back");
6889
6890 if(strlen(inputtext) > 63)
6891 return Dialog_Show(playerid, DIALOG_EDIT_ADMIN_5, DIALOG_STYLE_INPUT, "Editing; Admin Rank 5", "You are now editing Admin Rank #5;\n\n* Type in the new rank name for admin level 5.", "Set", "Back");
6892
6893 format(ServerInfo[AdminRank5], 32, inputtext);
6894 SaveConfig();
6895 ShowRanks(playerid);
6896 }
6897 else ShowRanks(playerid);
6898 return 1;
6899}
6900
6901Dialog:DIALOG_SETTINGS(playerid, response, listitem, inputtext[])
6902{
6903 static string[128];
6904 string[0] = 0;
6905
6906 if(response)
6907 {
6908 switch(listitem)
6909 {
6910 case 0: // Save Log
6911 {
6912 switch(ServerInfo[SaveLogs])
6913 {
6914 case 0:
6915 {
6916 format(string, sizeof(string), "* Admin %s has enable the Save Log Files feature (/jsettings)", pName(playerid));
6917 SendAdmin(COLOR_YELLOW, string);
6918 ServerInfo[SaveLogs] = 1;
6919 SaveConfig();
6920 }
6921 case 1:
6922 {
6923 format(string, sizeof(string), "* Admin %s has disable the Save Log Files feature (/jsettings)", pName(playerid));
6924 SendAdmin(COLOR_YELLOW, string);
6925 ServerInfo[SaveLogs] = 0;
6926 SaveConfig();
6927 }
6928 }
6929 ShowSettings(playerid);
6930 }
6931 case 1: // Login Tries
6932 {
6933 Dialog_Show(playerid, DIALOG_LOG_TRIES, DIALOG_STYLE_INPUT, "Login Tries", "Place in the amount of maximum login tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6934 }
6935 case 2: // Secure Tries
6936 {
6937 Dialog_Show(playerid, DIALOG_SEC_TRIES, DIALOG_STYLE_INPUT, "Secure Tries", "Place in the amount of maximum security question tries;\n\n* Once player reached this amount of tries, They will get kicked.", "Set", "Back");
6938 }
6939 case 3: // AutoLogin
6940 {
6941 switch(ServerInfo[AutoLogin])
6942 {
6943 case 0:
6944 {
6945 format(string, sizeof(string), "* Admin %s has enable the Auto Login feature (/jsettings)", pName(playerid));
6946 SendAdmin(COLOR_YELLOW, string);
6947 ServerInfo[AutoLogin] = 1;
6948 SaveConfig();
6949 }
6950 case 1:
6951 {
6952 format(string, sizeof(string), "* Admin %s has disable the Auto Login feature (/jsettings)", pName(playerid));
6953 SendAdmin(COLOR_YELLOW, string);
6954 ServerInfo[AutoLogin] = 0;
6955 SaveConfig();
6956 }
6957 }
6958 ShowSettings(playerid);
6959 }
6960 case 4: // Read Commands
6961 {
6962 switch(ServerInfo[ReadCmds])
6963 {
6964 case 0:
6965 {
6966 format(string, sizeof(string), "* Admin %s has enable the Read Player Commands feature (/jsettings)", pName(playerid));
6967 SendAdmin(COLOR_YELLOW, string);
6968 ServerInfo[ReadCmds] = 1;
6969 SaveConfig();
6970 }
6971 case 1:
6972 {
6973 format(string, sizeof(string), "* Admin %s has disable the Read Player Commands feature (/jsettings)", pName(playerid));
6974 SendAdmin(COLOR_YELLOW, string);
6975 ServerInfo[ReadCmds] = 0;
6976 SaveConfig();
6977 }
6978 }
6979 ShowSettings(playerid);
6980 }
6981 case 5: // Ping Kicker
6982 {
6983 Dialog_Show(playerid, DIALOG_PING, DIALOG_STYLE_INPUT, "Maximum Ping", "Place in the maximum ping in the server (E.G.; 1000);\n* Once player reached this ping, they will get warned first then kick.\n\n* To disable the Ping Kicker, simply place 0.", "Set", "Back");
6984 }
6985 case 6: // Anti Swear
6986 {
6987 switch(ServerInfo[AntiSwear])
6988 {
6989 case 0:
6990 {
6991 format(string, sizeof(string), "* Admin %s has enable the Anti-Swearing feature (/jsettings)", pName(playerid));
6992 SendAdmin(COLOR_YELLOW, string);
6993 ServerInfo[AntiSwear] = 1;
6994 SaveConfig();
6995 }
6996 case 1:
6997 {
6998 format(string, sizeof(string), "* Admin %s has disable the Anti-Swearing feature (/jsettings)", pName(playerid));
6999 SendAdmin(COLOR_YELLOW, string);
7000 ServerInfo[AntiSwear] = 0;
7001 SaveConfig();
7002 }
7003 }
7004 ShowSettings(playerid);
7005 }
7006 case 7: // Anti Name
7007 {
7008 switch(ServerInfo[AntiName])
7009 {
7010 case 0:
7011 {
7012 format(string, sizeof(string), "* Admin %s has enable the Anti-Name feature (/jsettings)", pName(playerid));
7013 SendAdmin(COLOR_YELLOW, string);
7014 ServerInfo[AntiName] = 1;
7015 SaveConfig();
7016 }
7017 case 1:
7018 {
7019 format(string, sizeof(string), "* Admin %s has disable the Anti-Name feature (/jsettings)", pName(playerid));
7020 SendAdmin(COLOR_YELLOW, string);
7021 ServerInfo[AntiName] = 0;
7022 SaveConfig();
7023 }
7024 }
7025 ShowSettings(playerid);
7026 }
7027 case 8: // Anti Ad
7028 {
7029 switch(ServerInfo[AntiAd])
7030 {
7031 case 0:
7032 {
7033 format(string, sizeof(string), "* Admin %s has enable the Anti-Advertisement feature (/jsettings)", pName(playerid));
7034 SendAdmin(COLOR_YELLOW, string);
7035 ServerInfo[AntiAd] = 1;
7036 SaveConfig();
7037 }
7038 case 1:
7039 {
7040 format(string, sizeof(string), "* Admin %s has disable the Anti-Advertisement feature (/jsettings)", pName(playerid));
7041 SendAdmin(COLOR_YELLOW, string);
7042 ServerInfo[AntiAd] = 0;
7043 SaveConfig();
7044 }
7045 }
7046 ShowSettings(playerid);
7047 }
7048 case 9: // Anti Spam
7049 {
7050 switch(ServerInfo[AntiSpam])
7051 {
7052 case 0:
7053 {
7054 format(string, sizeof(string), "* Admin %s has enable the Anti-Spam feature (/jsettings)", pName(playerid));
7055 SendAdmin(COLOR_YELLOW, string);
7056 ServerInfo[AntiSpam] = 1;
7057 SaveConfig();
7058 }
7059 case 1:
7060 {
7061 format(string, sizeof(string), "* Admin %s has disable the Anti-Spam feature (/jsettings)", pName(playerid));
7062 SendAdmin(COLOR_YELLOW, string);
7063 ServerInfo[AntiSpam] = 0;
7064 SaveConfig();
7065 }
7066 }
7067 ShowSettings(playerid);
7068 }
7069 case 10: // Read Command Type
7070 {
7071 switch(ServerInfo[ReadCmd])
7072 {
7073 case 0:
7074 {
7075 format(string, sizeof(string), "* Admin %s has switched to the Spectate Mode Command Reading (/jsettings)", pName(playerid));
7076 SendAdmin(COLOR_YELLOW, string);
7077 ServerInfo[ReadCmd] = 1;
7078 SaveConfig();
7079 }
7080 case 1:
7081 {
7082 format(string, sizeof(string), "* Admin %s has switched to the Normal Mode Command Reading (/jsettings)", pName(playerid));
7083 SendAdmin(COLOR_YELLOW, string);
7084 ServerInfo[ReadCmd] = 0;
7085 SaveConfig();
7086 }
7087 }
7088 ShowSettings(playerid);
7089 }
7090 case 11: // Register Optional
7091 {
7092 switch(ServerInfo[RegisterOption])
7093 {
7094 case 0:
7095 {
7096 format(string, sizeof(string), "* Admin %s has allow the Player's to skip the Registration. (/jsettings)", pName(playerid));
7097 SendAdmin(COLOR_YELLOW, string);
7098 ServerInfo[RegisterOption] = 1;
7099 SaveConfig();
7100 }
7101 case 1:
7102 {
7103 format(string, sizeof(string), "* Admin %s has no-longer allow the Player's to skip the Registration (/jsettings)", pName(playerid));
7104 SendAdmin(COLOR_YELLOW, string);
7105 ServerInfo[RegisterOption] = 0;
7106 SaveConfig();
7107 }
7108 }
7109 ShowSettings(playerid);
7110 }
7111 case 12: // Tabbed Kicker
7112 {
7113 Dialog_Show(playerid, DIALOG_TABBED, DIALOG_STYLE_INPUT, "Tabbed Seconds", "Place in the maximum time the player can alt-tab to. (0 to disable)", "Set", "Back");
7114 }
7115 case 13: // AFK Kicker
7116 {
7117 Dialog_Show(playerid, DIALOG_AFK, DIALOG_STYLE_INPUT, "Idle Seconds", "Place in the maximum time the player can idle to. (0 to disable)", "Set", "Back");
7118 }
7119 case 14: // Read PMs
7120 {
7121 switch(ServerInfo[ReadPMs])
7122 {
7123 case 0:
7124 {
7125 format(string, sizeof(string), "* Admin %s has enabled the Reading Private Messages feature (/jsettings)", pName(playerid));
7126 SendAdmin(COLOR_YELLOW, string);
7127 ServerInfo[ReadPMs] = 1;
7128 SaveConfig();
7129 }
7130 case 1:
7131 {
7132 format(string, sizeof(string), "* Admin %s has disabled the Reading Private Messages feature (/jsettings)", pName(playerid));
7133 SendAdmin(COLOR_YELLOW, string);
7134 ServerInfo[ReadPMs] = 0;
7135 SaveConfig();
7136 }
7137 }
7138 ShowSettings(playerid);
7139 }
7140 case 15: // Join/Left Messages
7141 {
7142 switch(ServerInfo[JoinMsg])
7143 {
7144 case 0:
7145 {
7146 format(string, sizeof(string), "* Admin %s has enabled the Join/Leave Messages (/jsettings)", pName(playerid));
7147 SendAdmin(COLOR_YELLOW, string);
7148 ServerInfo[JoinMsg] = 1;
7149 SaveConfig();
7150 }
7151 case 1:
7152 {
7153 format(string, sizeof(string), "* Admin %s has disabled the Join/Leave Messages (/jsettings)", pName(playerid));
7154 SendAdmin(COLOR_YELLOW, string);
7155 ServerInfo[JoinMsg] = 0;
7156 SaveConfig();
7157 }
7158 }
7159 ShowSettings(playerid);
7160 }
7161 case 16: // Ranks
7162 {
7163 ShowRanks(playerid);
7164 }
7165 }
7166 }
7167 return 1;
7168}
7169
7170Dialog:DIALOG_WOULDYOU(playerid, response, listitem, inputtext[])
7171{
7172 if(response)
7173 Dialog_Show(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""green"Security Question", "You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
7174 else
7175 SendClientMessage(playerid, COLOR_RED, "* You decided not to set a security question on your account.");
7176 return 1;
7177}
7178
7179Dialog:DIALOG_QUESTION(playerid, response, listitem, inputtext[])
7180{
7181 if(!response)
7182 Dialog_Show(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""green"Security Question", "You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
7183 else
7184 {
7185 if(strlen(inputtext) < 6 || strlen(inputtext) > 90)
7186 return Dialog_Show(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""green"Security Question", "You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
7187
7188 if(strcmp(inputtext, "none", true) == 0)
7189 return Dialog_Show(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""green"Security Question", "You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
7190
7191 format(User[playerid][accountQuestion], 92, "%s", inputtext);
7192 SaveData(playerid);
7193
7194 Dialog_Show(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""green"Security Answer", "You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
7195 }
7196 return 1;
7197}
7198
7199Dialog:DIALOG_ANSWER(playerid, response, listitem, inputtext[])
7200{
7201 if(!response)
7202 Dialog_Show(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""green"Security Answer", "You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
7203 else
7204 {
7205 if(strlen(inputtext) < 2 || strlen(inputtext) > 90)
7206 return Dialog_Show(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""green"Security Answer", "You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
7207
7208 new hashanswer[129];
7209 WP_Hash(hashanswer, 129, inputtext);
7210 format(User[playerid][accountAnswer], 129, "%s", hashanswer);
7211
7212 SendClientMessage(playerid, COLOR_YELLOW, "* You have successfully set your Security Question & Answer, Use the forget feature when you forgot your password.");
7213 SaveData(playerid);
7214 }
7215 return 1;
7216}
7217
7218Dialog:DIALOG_QUESTION2(playerid, response, listitem, inputtext[])
7219{
7220 if(response)
7221 {
7222 if(strlen(inputtext) < 6 || strlen(inputtext) > 90)
7223 return Dialog_Show(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""green"Security Question", "* Type in your new security question below;", "Set", "Cancel");
7224
7225 format(User[playerid][accountQuestion], 92, "%s", inputtext);
7226 SaveData(playerid);
7227
7228 Dialog_Show(playerid, DIALOG_ANSWER2, DIALOG_STYLE_INPUT, ""green"Security Answer", "* Type in your security answer below:", "Set", "Back");
7229 }
7230 return 1;
7231}
7232
7233Dialog:DIALOG_ANSWER2(playerid, response, listitem, inputtext[])
7234{
7235 if(!response)
7236 Dialog_Show(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""green"Security Question", "* Type in your new security question below;", "Set", "Cancel");
7237 else
7238 {
7239 if(strlen(inputtext) < 2 || strlen(inputtext) > 90)
7240 return Dialog_Show(playerid, DIALOG_ANSWER2, DIALOG_STYLE_INPUT, ""green"Security Answer", "* Type in your security answer below:", "Set", "Back");
7241
7242 new hashanswer[129];
7243 WP_Hash(hashanswer, 129, inputtext);
7244 format(User[playerid][accountAnswer], 129, "%s", hashanswer);
7245
7246 SendClientMessage(playerid, COLOR_YELLOW, "* You have successfully set your new Security Question & Answer.");
7247 SaveData(playerid);
7248 }
7249 return 1;
7250}
7251
7252Dialog:DIALOG_REGISTER(playerid, response, listitem, inputtext[])
7253{
7254 new hashpass[129];
7255
7256 if(response)
7257 {
7258 if(!IsValidPassword(inputtext))
7259 return Dialog_Show(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""green"Register", "Welcome to the Server!\nYour account doesn't exist in our database, Please insert your password below.\n\n"red"ERROR: Invalid Password Symbols.", "Register", "Quit");
7260
7261 if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
7262 return Dialog_Show(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""green"Register", "Welcome to the Server!\nYour account doesn't exist in our database, Please insert your password below.\n\n"red"ERROR: Password length shouldn't go below 4 and shouldn't go higher 20.", "Register", "Quit");
7263
7264 WP_Hash(hashpass, 129, inputtext);
7265
7266 RegisterPlayer(playerid, hashpass);
7267 }
7268 else
7269 {
7270 if(ServerInfo[RegisterOption])
7271 {
7272 SetPVarString(playerid, "old_name", pName(playerid));
7273 format(hashpass, sizeof(hashpass), "%s_%d", pName(playerid), (random(10000) + 1));
7274 SetPlayerName(playerid, hashpass);
7275 format(hashpass, sizeof(hashpass), "* You have skipped the registration, resulting on your name to be set to %s.", pName(playerid));
7276 SendClientMessage(playerid, COLOR_RED, hashpass);
7277 SendClientMessage(playerid, COLOR_GREEN, "* Signing-up your account will set your name back to normal.");
7278 }
7279 else
7280 KickDelay(playerid);
7281 }
7282 return 1;
7283}
7284
7285Dialog:DIALOG_LOGIN(playerid, response, listitem, inputtext[])
7286{
7287 new hashp[129];
7288 static string[900];
7289 string[0] = 0;
7290 if(response)
7291 {
7292 WP_Hash(hashp, 129, inputtext);
7293 if(!strcmp(hashp, User[playerid][accountPassword], false))
7294 {
7295 LoginPlayer(playerid);
7296 }
7297 else
7298 {
7299 User[playerid][WarnLog]++;
7300
7301 if(User[playerid][WarnLog] >= ServerInfo[LoginWarn])
7302 {
7303 ////////////////////////////////////////////////////////////////////////////
7304 new DBResult:jResult, ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second;
7305 getdate(ip_year, ip_month, ip_day);
7306 gettime(ip_hour, ip_minute, ip_second);
7307 format(string, sizeof(string), "SELECT * FROM `breach` WHERE `username` = '%s' AND `ip` = '%s'", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]));
7308 jResult = db_query(Database, string);
7309 if(!db_num_rows(jResult))
7310 {
7311 format(string, sizeof(string), "INSERT INTO `breach` (`username`, `ip`, `type`, `date`, `time`) VALUES('%s', '%s', 1, '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
7312 db_query(Database, string);
7313 }
7314 else
7315 {
7316 format(string, sizeof(string), "DELETE FROM `breach` WHERE `ip` = '%s'", DB_Escape(User[playerid][accountIP]));
7317 db_query(Database, string);
7318 format(string, sizeof(string), "INSERT INTO `breach` (`username`, `ip`, `type`, `date`, `time`) VALUES('%s', '%s', 1, '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
7319 db_query(Database, string);
7320 }
7321 db_free_result(jResult);
7322 ////////////////////////////////////////////////////////////////////////////
7323 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server.", "Close", "");
7324 return KickDelay(playerid);
7325 }
7326
7327 if(!strcmp(User[playerid][accountQuestion], "none", true))
7328 {
7329 format(string, sizeof(string), "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.\n\n"red"* Wrong password (%d/%d)", User[playerid][WarnLog], ServerInfo[LoginWarn]);
7330 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", string, "Login", "Quit");
7331 }
7332 else
7333 {
7334 format(string, sizeof(string), "Welcome back to the server!\nYour account exists in our database.\nPlease insert your account's password below to login.\n\nPress Forget button if you have forgotten your account's password\n\n"red"* Wrong password (%d/%d)", User[playerid][WarnLog], ServerInfo[LoginWarn]);
7335 Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""green"Login", string, "Login", "Forget");
7336 }
7337 printf("[LOGIN ATTEMPT] %s (IP: %s) tries to login to their account with the password '%s' (attempts: %d)", pName(playerid), User[playerid][accountIP], inputtext, (ServerInfo[LoginWarn]-User[playerid][WarnLog]));
7338 }
7339 }
7340 else
7341 {
7342 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
7343 {
7344 KickDelay(playerid);
7345 }
7346 else
7347 {
7348 format(string, sizeof(string), "You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.", User[playerid][accountQuestion]);
7349 Dialog_Show(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""green"Security Question", string, "Answer", "Quit");
7350
7351 printf("[LOGIN ATTEMPT] %s (IP: %s) uses the 'Forgot Password' option for their account.", pName(playerid), User[playerid][accountIP]);
7352 }
7353 }
7354 return 1;
7355}
7356
7357Dialog:DIALOG_FORGET(playerid, response, listitem, inputtext[])
7358{
7359 if(!response)
7360 {
7361 KickDelay(playerid);
7362 }
7363 else
7364 {
7365 new hashanswer[129];
7366 WP_Hash(hashanswer, 129, inputtext);
7367
7368 if(strcmp(User[playerid][accountAnswer], hashanswer, true) == 0)
7369 {
7370 LoginPlayer(playerid);
7371 SendClientMessage(playerid, -1, "Access granted.");
7372 printf("[LOGIN SUCCESSFUL] %s (IP: %s) has successfully logged in to their account from using Forget Password option.", pName(playerid), User[playerid][accountIP]);
7373 }
7374 else
7375 {
7376 static string[900];
7377 string[0] = 0;
7378
7379 User[playerid][WarnLog]++;
7380
7381 if(User[playerid][WarnLog] >= ServerInfo[SecureWarn])
7382 {
7383 ////////////////////////////////////////////////////////////////////////////
7384 new DBResult:jResult, ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second;
7385 getdate(ip_year, ip_month, ip_day);
7386 gettime(ip_hour, ip_minute, ip_second);
7387 format(string, sizeof(string), "SELECT * FROM `breach` WHERE `username` = '%s' AND `ip` = '%s'", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]));
7388 jResult = db_query(Database, string);
7389 if(!db_num_rows(jResult))
7390 {
7391 format(string, sizeof(string), "INSERT INTO `breach` (`username`, `ip`, `type`, `date`, `time`) VALUES('%s', '%s', 2, '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
7392 db_query(Database, string);
7393 }
7394 else
7395 {
7396 format(string, sizeof(string), "DELETE FROM `breach` WHERE `ip` = '%s'", DB_Escape(User[playerid][accountIP]));
7397 db_query(Database, string);
7398 format(string, sizeof(string), "INSERT INTO `breach` (`username`, `ip`, `type`, `date`, `time`) VALUES('%s', '%s', 2, '%02d-%02d-%d', '%02d:%02d:%02d')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), ip_month, ip_day, ip_year, ip_hour, ip_minute, ip_second);
7399 db_query(Database, string);
7400 }
7401 db_free_result(jResult);
7402 ////////////////////////////////////////////////////////////////////////////
7403 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server.", "Close", "");
7404 return KickDelay(playerid);
7405 }
7406
7407 format(string, sizeof(string), ""grey"You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.\n\nERROR: Wrong Answer on the question.\n* %d/%d", User[playerid][accountQuestion], User[playerid][WarnLog], ServerInfo[SecureWarn]);
7408 Dialog_Show(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
7409
7410 printf("[LOGIN SUCCESSFUL] %s (IP: %s) has answered the Security Question wrong. (attempts: %d)", pName(playerid), User[playerid][accountIP], (ServerInfo[SecureWarn]-User[playerid][WarnLog]));
7411 }
7412 }
7413 return 1;
7414}
7415
7416Dialog:DIALOG_COLORS(playerid, response, listitem, inputtext[])
7417{
7418 static string[120];
7419 string[0] = 0;
7420 new id = GetPVarInt(playerid, "_Colors_");
7421
7422 switch( response )
7423 {
7424 case 0:
7425 {
7426 DeletePVar(playerid, "_Colors_");
7427 SendClientMessage(playerid, -1, "Colour setting has been cancelled.");
7428 }
7429 case 1:
7430 {
7431 switch( listitem )
7432 {
7433 case 0:
7434 {
7435 format(string, sizeof(string), "Admin %s has set your name color to Black", pName(playerid));
7436 SendClientMessage(id, COLOR_YELLOW, string);
7437 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7438 SendClientMessage(playerid, COLOR_YELLOW, string);
7439 SetPlayerColor(id, COLOR_BLACK);
7440 DeletePVar(playerid, "_Colors_");
7441 }
7442 case 1:
7443 {
7444 format(string, sizeof(string), "Admin %s has set your name color to White", pName(playerid));
7445 SendClientMessage(id, COLOR_YELLOW, string);
7446 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7447 SendClientMessage(playerid, COLOR_YELLOW, string);
7448 SetPlayerColor(id, COLOR_WHITE);
7449 DeletePVar(playerid, "_Colors_");
7450 }
7451 case 2:
7452 {
7453 format(string, sizeof(string), "Admin %s has set your name color to Red", pName(playerid));
7454 SendClientMessage(id, COLOR_YELLOW, string);
7455 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7456 SendClientMessage(playerid, COLOR_YELLOW, string);
7457 SetPlayerColor(id, COLOR_RED);
7458 DeletePVar(playerid, "_Colors_");
7459 }
7460 case 3:
7461 {
7462 format(string, sizeof(string), "Admin %s has set your name color to Orange", pName(playerid));
7463 SendClientMessage(id, COLOR_YELLOW, string);
7464 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7465 SendClientMessage(playerid, COLOR_YELLOW, string);
7466 SetPlayerColor(id, COLOR_ORANGE);
7467 DeletePVar(playerid, "_Colors_");
7468 }
7469 case 4:
7470 {
7471 format(string, sizeof(string), "Admin %s has set your name color to Yellow", pName(playerid));
7472 SendClientMessage(id, COLOR_YELLOW, string);
7473 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7474 SendClientMessage(playerid, COLOR_YELLOW, string);
7475 SetPlayerColor(id, COLOR_YELLOW);
7476 DeletePVar(playerid, "_Colors_");
7477 }
7478 case 5:
7479 {
7480 format(string, sizeof(string), "Admin %s has set your name color to Green", pName(playerid));
7481 SendClientMessage(id, COLOR_YELLOW, string);
7482 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7483 SendClientMessage(playerid, COLOR_YELLOW, string);
7484 SetPlayerColor(id, COLOR_GREEN);
7485 DeletePVar(playerid, "_Colors_");
7486 }
7487 case 6:
7488 {
7489 format(string, sizeof(string), "Admin %s has set your name color to Blue", pName(playerid));
7490 SendClientMessage(id, COLOR_YELLOW, string);
7491 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7492 SendClientMessage(playerid, COLOR_YELLOW, string);
7493 SetPlayerColor(id, COLOR_BLUE);
7494 DeletePVar(playerid, "_Colors_");
7495 }
7496 case 7:
7497 {
7498 format(string, sizeof(string), "Admin %s has set your name color to Purple", pName(playerid));
7499 SendClientMessage(id, COLOR_YELLOW, string);
7500 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7501 SendClientMessage(playerid, COLOR_YELLOW, string);
7502 SetPlayerColor(id, COLOR_PURPLE);
7503 DeletePVar(playerid, "_Colors_");
7504 }
7505 case 8:
7506 {
7507 format(string, sizeof(string), "Admin %s has set your name color to Brown", pName(playerid));
7508 SendClientMessage(id, COLOR_YELLOW, string);
7509 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7510 SendClientMessage(playerid, COLOR_YELLOW, string);
7511 SetPlayerColor(id, COLOR_BROWN);
7512 DeletePVar(playerid, "_Colors_");
7513 }
7514 case 9:
7515 {
7516 format(string, sizeof(string), "Admin %s has set your name color to Pink", pName(playerid));
7517 SendClientMessage(id, COLOR_YELLOW, string);
7518 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
7519 SendClientMessage(playerid, COLOR_YELLOW, string);
7520 SetPlayerColor(id, COLOR_PINK);
7521 DeletePVar(playerid, "_Colors_");
7522 }
7523 }
7524 }
7525 }
7526 return 1;
7527}
7528//============================================================================//
7529
7530public OnPlayerClickPlayer(playerid, clickedplayerid, source)
7531{
7532 ExecuteClickManager(playerid, clickedplayerid);
7533 return 1;
7534}
7535
7536//============================================================================//
7537//Stock and functions starts here.
7538
7539stock ConvertTimestamp(timestamp, _form=0)
7540{
7541 new year=1970, day=0, month=0, hourt=0, mins=0, sec=0;
7542
7543 new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
7544 new names_of_month[12][10] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
7545 new returnstring[32];
7546
7547 while(timestamp>31622400){
7548 timestamp -= 31536000;
7549 if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp -= 86400;
7550 year++;
7551 }
7552
7553 if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
7554 days_of_month[1] = 29;
7555 else
7556 days_of_month[1] = 28;
7557
7558
7559 while(timestamp>86400){
7560 timestamp -= 86400, day++;
7561 if(day==days_of_month[month]) day=0, month++;
7562 }
7563
7564 while(timestamp>60){
7565 timestamp -= 60, mins++;
7566 if( mins == 60) mins=0, hourt++;
7567 }
7568
7569 sec=timestamp;
7570
7571 switch( _form ){
7572 case 1: format(returnstring, 31, "%02d/%02d/%d %02d:%02d:%02d", day+1, month+1, year, hourt, mins, sec);
7573 case 2: format(returnstring, 31, "%s %02d, %d, %02d:%02d:%02d", names_of_month[month],day+1,year, hourt, mins, sec);
7574 case 3: format(returnstring, 31, "%d %c%c%c %d, %02d:%02d", day+1,names_of_month[month][0],names_of_month[month][1],names_of_month[month][2], year,hourt,mins);
7575 case 4: format(returnstring, 31, "%s %02d, %d", names_of_month[month],day+1,year);
7576 default: format(returnstring, 31, "%02d.%02d.%d-%02d:%02d:%02d", day+1, month+1, year, hourt, mins, sec);
7577 }
7578 return returnstring;
7579}
7580
7581stock ExecuteClickManager(playerid, clickedplayerid)
7582{
7583 new string[64], dialog_content[500];
7584 SetPVarInt(playerid, "punish_clicked", clickedplayerid);
7585 format(string, sizeof(string), "** Punishment: %s (ID: %d)", pName(clickedplayerid), clickedplayerid);
7586
7587 if(User[playerid][accountAdmin] < 1) format(dialog_content, sizeof(dialog_content), "Report this player");
7588 if(User[playerid][accountAdmin] >= 1) format(dialog_content, sizeof(dialog_content), "IP: %s\nKick\nTeleport to this player\nRespawn", getIP(clickedplayerid));
7589 if(User[playerid][accountAdmin] >= 2) format(dialog_content, sizeof(dialog_content), "%s\nExplode\nKill this player\nSpectate\nJetpack", dialog_content);
7590 if(User[playerid][accountAdmin] >= 3) format(dialog_content, sizeof(dialog_content), "%s\nSlap\nSmash the Hammer\nTeleport player to you\nCrash their game", dialog_content);
7591
7592 Dialog_Show(playerid, DIALOG_PUNISHMENT, DIALOG_STYLE_LIST, string, dialog_content, "Take Action", "Close");
7593 return 1;
7594}
7595
7596stock pName(playerid)
7597{
7598 new GetName[24];
7599 GetPlayerName(playerid, GetName, 24);
7600 return GetName;
7601}
7602
7603#if defined USE_AKA
7604function:LoadAKA(playerid)
7605{
7606 new query[128 * 10], string[128 * 10], pAka[128 * 10], DBResult:result;
7607 format(query, sizeof(query), "SELECT * FROM `aka` WHERE `ip` = '%s'", User[playerid][accountIP]);
7608 result = db_query(Database, query);
7609 if(!db_num_rows(result))
7610 {
7611 format(query, sizeof(query), "INSERT INTO `aka` ('ip', 'name') VALUES ('%s', '%s')", User[playerid][accountIP], pName(playerid));
7612 db_query(Database, query);
7613 }
7614 else
7615 {
7616 db_get_field_assoc(result, "name", pAka, sizeof(pAka));
7617 format(string, sizeof(string), "%s, %s", pAka, pName(playerid));
7618 if(strfind(pAka, pName(playerid), true) == -1)
7619 {
7620 format(query, sizeof(query), "UPDATE `aka` SET `name` = '%s' WHERE `ip` = '%s'", string, User[playerid][accountIP]);
7621 db_query(Database, query);
7622 }
7623 }
7624 db_free_result(result);
7625 return 1;
7626}
7627#endif
7628
7629function:IsAdvertisement(szInput[])
7630{
7631 new
7632 iCount,
7633 iPeriod,
7634 iPos,
7635 iChar,
7636 iColon;
7637
7638 while((iChar = szInput[iPos++])) {
7639 if('0' <= iChar <= '9') iCount++;
7640 else if(iChar == '.') iPeriod++;
7641 else if(iChar == ':') iColon++;
7642 }
7643 if(iCount >= 7 && iPeriod >= 3 && iColon >= 1) {
7644 return 1;
7645 }
7646 return 0;
7647}
7648
7649function:Offline_ShowStatistics(playerid, name[])
7650{
7651 new query[128], DBResult:result, id;
7652 new hours, minutes, seconds, chocolate;
7653 new admin, kills, deaths, accountid, money, score, joinDate[64], lastOn[32];
7654
7655 id = ReturnUser(name);
7656 if(IsPlayerConnected(id))
7657 {
7658 format(query, sizeof(query), "* '%s' is online, /stats %d.", pName(id), id);
7659 return SendClientMessage(playerid, COLOR_RED, query);
7660 }
7661
7662 format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
7663 result = db_query(Database, query);
7664
7665 if(db_num_rows(result))
7666 {
7667 accountid = db_get_field_assoc_int(result, "userid");
7668 score = db_get_field_assoc_int(result, "score");
7669 money = db_get_field_assoc_int(result, "money");
7670 kills = db_get_field_assoc_int(result, "kills");
7671 deaths = db_get_field_assoc_int(result, "deaths");
7672 admin = db_get_field_assoc_int(result, "admin");
7673 db_get_field_assoc(result, "joindate", joinDate, sizeof(joinDate));
7674 hours = db_get_field_assoc_int(result, "hours");
7675 minutes = db_get_field_assoc_int(result, "minutes");
7676 seconds = db_get_field_assoc_int(result, "seconds");
7677 chocolate = db_get_field_assoc_int(result, "chocolate");
7678 db_get_field_assoc(result, "laston", lastOn, sizeof(lastOn));
7679
7680 new Float:ratio = (float(kills)/float(deaths));
7681
7682 #if defined USE_DIALOG
7683 new string[1000], string2[128];
7684
7685 strcat(string, ""white"");
7686 format(string2, sizeof(string2), "-> "green"User Name: "white"%s\n", name);
7687 strcat(string, string2);
7688 format(string2, sizeof(string2), "-> "green"User ID: "white"#%d\n", accountid);
7689 strcat(string, string2);
7690 format(string2, sizeof(string2), "-> "green"Register Date: "white"%s\n", joinDate);
7691 strcat(string, string2);
7692 format(string2, sizeof(string2), "-> "green"Total Playing Time: "white"%02d:%02d:%02d\n", hours, minutes, seconds);
7693 strcat(string, string2);
7694 format(string2, sizeof(string2), "-> "green"Admin Level: "white"(%d) %s\n", admin, GetAdminRank(admin));
7695 strcat(string, string2);
7696 format(string2, sizeof(string2), "-> "green"Chocolate Bars: "white"%d\n", chocolate);
7697 strcat(string, string2);
7698 format(string2, sizeof(string2), "-> "green"Score: "white"%d\n", score);
7699 strcat(string, string2);
7700 format(string2, sizeof(string2), "-> "green"Cash: "white"$%d\n", money);
7701 strcat(string, string2);
7702 format(string2, sizeof(string2), "-> "green"Kills: "white"%d\n", kills);
7703 strcat(string, string2);
7704 format(string2, sizeof(string2), "-> "green"Deaths: "white"%d\n", deaths);
7705 strcat(string, string2);
7706 format(string2, sizeof(string2), "-> "green"K/D (Ratio): "white"%.3f\n\n", ratio);
7707 strcat(string, string2);
7708 format(string2, sizeof(string2), ""grey"%s was last seen on "red"%s"grey".", name, lastOn);
7709 strcat(string, string2);
7710
7711 format(string2, sizeof(string2), ""green"%s", name);
7712 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
7713 #else
7714 new string[128];
7715 SendClientMessage(playerid, COLOR_GREEN, "_________________________________________________________________________________");
7716 SendClientMessage(playerid, -1, "User's Statistics...");
7717 format(string, sizeof(string), "%s - UserID: %d | Registration Date: %s | Total Time: %02d:%02d:%02d", name, accountid, joinDate, hours, minutes, seconds);
7718 SendClientMessage(playerid, COLOR_GREEN, string);
7719 format(string, sizeof(string), "Admin Level: (%d) %s | Chocolates: %d | Score: %d | Cash: $%d | Kills: %d | Deaths: %d | K/D: %.3f", admin, GetAdminRank(admin), chocolate, score, money, kills, deaths, ratio);
7720 SendClientMessage(playerid, COLOR_GREEN, string);
7721 format(string, sizeof(string), "%s was last seen on "red"%s"grey".", name, lastOn);
7722 SendClientMessage(playerid, COLOR_GREY, string);
7723 SendClientMessage(playerid, COLOR_GREEN, "_________________________________________________________________________________");
7724 #endif
7725 }
7726 else
7727 {
7728 format(query, sizeof(query), "* '%s' is not found in the player's database.", name);
7729 SendClientMessage(playerid, COLOR_RED, query);
7730 }
7731 db_free_result(result);
7732 return 1;
7733}
7734
7735function:ShowStatistics(playerid, playerid2)
7736{
7737 if(playerid2 == INVALID_PLAYER_ID) return 1; //Do not proceed.
7738
7739 new temp, hours, minutes, seconds;
7740 temp = (gettime()-User[playerid2][accountGameEx]) % 3600;
7741 hours = (gettime() - User[playerid2][accountGameEx] - temp) / 3600;
7742 minutes = (temp - (temp % 60)) / 60;
7743 seconds = temp % 60;
7744 new Float:ratio = (float(User[playerid2][accountKills])/float(User[playerid2][accountDeaths]));
7745
7746 #if defined USE_DIALOG
7747 new string[1000], string2[128];
7748
7749 strcat(string, ""white"");
7750 format(string2, sizeof(string2), "-> "green"User Name: "white"%s (ID: %d)\n", pName(playerid2), playerid2);
7751 strcat(string, string2);
7752 format(string2, sizeof(string2), "-> "green"User ID: "white"#%d\n", User[playerid2][accountID]);
7753 strcat(string, string2);
7754 format(string2, sizeof(string2), "-> "green"Register Date: "white"%s\n", User[playerid2][accountDate]);
7755 strcat(string, string2);
7756 format(string2, sizeof(string2), "-> "green"Online Time: "white"%02d:%02d:%02d\n", hours, minutes, seconds);
7757 strcat(string, string2);
7758 format(string2, sizeof(string2), "-> "green"Total Playing Time: "white"%02d:%02d:%02d\n", User[playerid2][accountGame][2], User[playerid2][accountGame][1], User[playerid2][accountGame][0]);
7759 strcat(string, string2);
7760 format(string2, sizeof(string2), "-> "green"Admin Level: "white"(%d) %s\n", User[playerid2][accountAdmin], GetAdminRank(User[playerid2][accountAdmin]));
7761 strcat(string, string2);
7762 format(string2, sizeof(string2), "-> "green"Chocolate Bars: "white"%d\n", User[playerid2][accountChocolate]);
7763 strcat(string, string2);
7764 format(string2, sizeof(string2), "-> "green"Score: "white"%d\n", GetPlayerScore(playerid2));
7765 strcat(string, string2);
7766 format(string2, sizeof(string2), "-> "green"Cash: "white"$%d\n", GetPlayerMoney(playerid2));
7767 strcat(string, string2);
7768 format(string2, sizeof(string2), "-> "green"Kills: "white"%d\n", User[playerid2][accountKills]);
7769 strcat(string, string2);
7770 format(string2, sizeof(string2), "-> "green"Deaths: "white"%d\n", User[playerid2][accountDeaths]);
7771 strcat(string, string2);
7772 format(string2, sizeof(string2), "-> "green"K/D (Ratio): "white"%.3f\n", ratio);
7773 strcat(string, string2);
7774
7775 format(string2, sizeof(string2), ""lightblue"%s", pName(playerid2));
7776 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
7777 #else
7778 new string[128];
7779 SendClientMessage(playerid, COLOR_GREEN, "_________________________________________________________________________________");
7780 SendClientMessage(playerid, -1, "User's Statistics...");
7781 format(string, sizeof(string), "%s (ID: %d) - UserID: %d | Registration Date: %s | Online Time: %02d:%02d:%02d", pName(playerid2), playerid2, User[playerid2][accountID], User[playerid2][accountDate], hours, minutes, seconds);
7782 SendClientMessage(playerid, COLOR_GREEN, string);
7783 format(string, sizeof(string), "Admin Level: (%d) %s | Chocolates: %d | Score: %d | Cash: $%d | Kills: %d | Deaths: %d | K/D: %.3f", User[playerid2][accountAdmin], GetAdminRank(User[playerid2][accountAdmin]), User[playerid2][accountChocolate], GetPlayerScore(playerid2), GetPlayerMoney(playerid2), User[playerid2][accountKills], User[playerid2][accountDeaths], ratio);
7784 SendClientMessage(playerid, COLOR_GREEN, string);
7785 format(string, sizeof(string), "Total Time: %02d:%02d:%02d", User[playerid2][accountGame][2], User[playerid2][accountGame][1], User[playerid2][accountGame][0]);
7786 SendClientMessage(playerid, COLOR_GREEN, string);
7787 SendClientMessage(playerid, COLOR_GREEN, "_________________________________________________________________________________");
7788 #endif
7789 return 1;
7790}
7791
7792function:KickMe(playerid) return Kick(playerid);
7793stock KickDelay(playerid) return SetTimerEx("KickMe", 800, false, "d", playerid);
7794
7795stock ReturnUser(text[], playerid = INVALID_PLAYER_ID)
7796{
7797 new pos = 0;
7798 while (text[pos] < 0x21)
7799 {
7800 if (text[pos] == 0) return INVALID_PLAYER_ID;
7801 pos++;
7802 }
7803
7804 new userid = INVALID_PLAYER_ID;
7805 if (isnumeric(text[pos]))
7806 {
7807 userid = strval(text[pos]);
7808 if (userid >=0 && userid < MAX_PLAYERS)
7809 {
7810 if(!IsPlayerConnected(userid))
7811 userid = INVALID_PLAYER_ID;
7812 else return userid;
7813 }
7814 }
7815
7816 new len = strlen(text[pos]);
7817 new count = 0;
7818 new pname[MAX_PLAYER_NAME];
7819
7820 for (new i = 0; i < MAX_PLAYERS; i++)
7821 {
7822 if (IsPlayerConnected(i))
7823 {
7824 GetPlayerName(i, pname, sizeof (pname));
7825 if (strcmp(pname, text[pos], true, len) == 0)
7826 {
7827 if (len == strlen(pname)) return i;
7828 else
7829 {
7830 count++;
7831 userid = i;
7832 }
7833 }
7834 }
7835 }
7836
7837 if (count != 1)
7838 {
7839 if (playerid != INVALID_PLAYER_ID)
7840 {
7841 if (count) SendClientMessage(playerid, COLOR_WHITE, "Enter the full name of the user.");
7842 else SendClientMessage(playerid, COLOR_GREY, "No results found for the specified phrase.");
7843 }
7844 userid = INVALID_PLAYER_ID;
7845 }
7846 return userid;
7847}
7848
7849stock Deploy_Label(playerid, color, label[], Float:distance, seethrough)
7850{
7851 new string[160];
7852 for(new i; i < MAX_DEPLOYABLE_LABEL; i++) if(!lInfo[i][label3D])
7853 {
7854 GetPlayerPos(playerid, lInfo[i][labelX], lInfo[i][labelY], lInfo[i][labelZ]);
7855 lInfo[i][labelInterior] = GetPlayerInterior(playerid);
7856 lInfo[i][labelVW] = GetPlayerVirtualWorld(playerid);
7857 lInfo[i][labelTaken] = true;
7858 format(string, sizeof(string), "{FFFFFF}(Label ID %d)\n{%06x}%s", i + 1, color >>> 8, label);
7859 lInfo[i][label3D] = CreateDynamic3DTextLabel(string, color, lInfo[i][labelX], lInfo[i][labelY], lInfo[i][labelZ], distance, .testlos = seethrough, .worldid = lInfo[i][labelVW], .interiorid = lInfo[i][labelInterior]);
7860 return i;
7861 }
7862 return -1;
7863}
7864
7865stock loadb()
7866{
7867 new string[128 * 10];
7868
7869 Database = db_open(_DB_);
7870
7871 // Users Table
7872 strcat(string, "CREATE TABLE IF NOT EXISTS `users` ");
7873 strcat(string, "(");
7874 strcat(string, "`userid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` STRING, `IP` STRING, `joindate` STRING, `password` STRING, `admin` INTEGER DEFAULT 0, ");
7875 strcat(string, "`kills` INTEGER DEFAULT 0, `deaths` INTEGER DEFAULT 0, `score` INTEGER DEFAULT 0, `money` INTEGER DEFAULT 0, `warn` INTEGER DEFAULT 0, ");
7876 strcat(string, "`mute` INTEGER DEFAULT 0, `mutesec` INTEGER DEFAULT 0, `cmute` INTEGER DEFAULT 0, `cmutesec` INTEGER DEFAULT 0, `jail` INTEGER DEFAULT 0, `jailsec` INTEGER DEFAULT 0, ");
7877 strcat(string, "`hours` INTEGER DEFAULT 0, `minutes` INTEGER DEFAULT 0, `seconds` INTEGER DEFAULT 0, `question` STRING DEFAULT 'none', `answer` STRING DEFAULT 'none'");
7878 strcat(string, ")");
7879 db_query(Database, string);
7880 // Adding more column without deleting the table for old users of JakAdmin - COLUMN: chocolate, useskin (INTEGER DEFAULT 0) skin (INTEGER DEFAULT: -1)
7881 db_query(Database, "ALTER TABLE `users` ADD COLUMN `chocolate` INTEGER DEFAULT 0");
7882 db_query(Database, "ALTER TABLE `users` ADD COLUMN `skin` INTEGER DEFAULT -1");
7883 db_query(Database, "ALTER TABLE `users` ADD COLUMN `useskin` INTEGER DEFAULT 0");
7884 db_query(Database, "ALTER TABLE `users` ADD COLUMN `togpm` INTEGER DEFAULT 1");
7885 db_query(Database, "ALTER TABLE `users` ADD COLUMN `cage` INTEGER DEFAULT 0");
7886 db_query(Database, "ALTER TABLE `users` ADD COLUMN `laston` STRING DEFAULT '01.01.1970 00:00:00'");
7887 // Remove this code if you already have the column CHOCOLATE, USESKIN, SKIN in your database to prevent having a SQL error "duplicate" thing
7888
7889 // Bans Table
7890 db_query(Database, "CREATE TABLE IF NOT EXISTS `bans` (`banid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` STRING, `ip` STRING, `banby` STRING, `banreason` STRING, `banwhen` STRING)");
7891 db_query(Database, "ALTER TABLE `bans` ADD COLUMN `temporary_ban` INTEGER DEFAULT 0");
7892
7893 // Notes System
7894 db_query(Database, "CREATE TABLE IF NOT EXISTS `notes` (`noteid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` STRING, `admin` STRING, `note` STRING, `date` STRING)");
7895
7896 // IP System
7897 db_query(Database, "CREATE TABLE IF NOT EXISTS `ips` (`username` STRING, `ip` STRING, `date` STRING, `time` STRING)");
7898
7899 // Breach System
7900 db_query(Database, "CREATE TABLE IF NOT EXISTS `breach` (`username` STRING, `ip` STRING, `type` INTEGER, `date` STRING, `time` STRING)");
7901
7902 // AKA System
7903 #if defined USE_AKA
7904 db_query(Database, "CREATE TABLE IF NOT EXISTS `aka` (`ip` STRING, `name` STRING)");
7905 #endif
7906 return 1;
7907}
7908
7909stock closedb() return db_close(Database);
7910
7911stock CheckAccount(name[])
7912{
7913 new query[128], DBResult:result, id;
7914 format(query, sizeof(query), "SELECT `userid` FROM `users` WHERE `username` = '%s'", DB_Escape(name));
7915 result = db_query(Database, query);
7916
7917 if(db_num_rows(result))
7918 {
7919 id = db_get_field_assoc_int(result, "userid");
7920 }
7921 db_free_result(result);
7922 return id;
7923}
7924
7925function:SaveData(playerid)
7926{
7927 new l_day, l_month, l_year, l_hour, l_minute, l_second;
7928 static Query[128 * 15];
7929 Query[0] = 0;
7930
7931 getdate(l_year, l_month, l_day);
7932 gettime(l_hour, l_minute, l_second);
7933
7934 format(User[playerid][accountLastOn], 32, "%02d.%02d.%d %02d:%02d:%02d", l_month, l_day, l_year, l_hour, l_minute, l_second);
7935
7936 if(User[playerid][accountLogged])
7937 {
7938 format(Query, sizeof(Query), "UPDATE `users` SET `IP` = '%s', `admin` = %d, `kills` = %d, `deaths` = %d, `score` = %d, `money` = %d, `warn` = %d, `mute` = %d, `mutesec` = %d, `cmute` = %d, `cmutesec` = %d, `jail` = %d, `jailsec` = %d, `hours` = %d, `minutes` = %d, `seconds` = %d, `question` = '%s', `answer` = '%s', `chocolate` = %d, `skin` = %d, `useskin` = %d, `togpm` = %d, `cage` = %d, `laston` = '%s' WHERE `username` = '%s'",
7939 DB_Escape(User[playerid][accountIP]),
7940 User[playerid][accountAdmin],
7941 User[playerid][accountKills],
7942 User[playerid][accountDeaths],
7943 GetPlayerScore(playerid),
7944 GetPlayerMoney(playerid),
7945 User[playerid][accountWarn],
7946 User[playerid][accountMuted],
7947 User[playerid][accountMuteSec],
7948 User[playerid][accountCMuted],
7949 User[playerid][accountCMuteSec],
7950 User[playerid][accountJail],
7951 User[playerid][accountJailSec],
7952 User[playerid][accountGame][2],
7953 User[playerid][accountGame][1],
7954 User[playerid][accountGame][0],
7955 DB_Escape(User[playerid][accountQuestion]),
7956 DB_Escape(User[playerid][accountAnswer]),
7957 User[playerid][accountChocolate],
7958 User[playerid][accountSkin],
7959 User[playerid][accountUseSkin],
7960 User[playerid][accountPM],
7961 User[playerid][accountCage],
7962 DB_Escape(User[playerid][accountLastOn]),
7963 DB_Escape(User[playerid][accountName])
7964 );
7965
7966 db_query(Database, Query);
7967 }
7968 return 1;
7969}
7970
7971stock getIP(playerid)
7972{
7973 new twerp[20];
7974 GetPlayerIp(playerid, twerp, 20);
7975 return twerp;
7976}
7977
7978stock GetWeaponIDFromName(WeaponName[])
7979{
7980 if(strfind("molotov", WeaponName, true) != -1) return 18;
7981 for(new i = 0; i <= 46; i++)
7982 {
7983 switch(i)
7984 {
7985 case 0,19,20,21,44,45: continue;
7986 default:
7987 {
7988 new name[32]; GetWeaponName(i,name,32);
7989 if(strfind(name,WeaponName,true) != -1) return i;
7990 }
7991 }
7992 }
7993 return -1;
7994}
7995
7996function:RegisterPlayer(playerid, password[])
7997{
7998 SetPlayerScore(playerid, STARTING_SCORE);
7999 GivePlayerMoney(playerid, STARTING_CASH);
8000
8001 //Time = Hours, Time2 = Minutes, Time3 = Seconds
8002 new time, time2, time3;
8003 gettime(time, time2, time3);
8004 new date, date2, date3;
8005 //Date = Month, Date2 = Day, Date3 = Year
8006 getdate(date3, date, date2);
8007
8008 format(User[playerid][accountDate], 64, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);
8009
8010 format(User[playerid][accountQuestion], 129, "none");
8011 format(User[playerid][accountAnswer], 129, "none");
8012
8013 static query[128 * 3];
8014 query[0] = 0;
8015
8016 format(query, sizeof(query), "INSERT INTO `users` (`username`, `IP`, `joindate`, `password`) VALUES ('%s', '%s', '%s', '%s')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), DB_Escape(User[playerid][accountDate]), DB_Escape(password));
8017 db_query(Database, query);
8018
8019 User[playerid][accountLogged] = true;
8020
8021 PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
8022
8023 new DBResult: result;
8024 result = db_query(Database, "SELECT last_insert_rowid()");
8025 User[playerid][accountID] = db_get_field_int(result);
8026 db_free_result(result);
8027
8028 SendClientMessage(playerid, COLOR_GREEN, "You have successfully registered from the server.");
8029
8030 Dialog_Show(playerid, DIALOG_WOULDYOU, DIALOG_STYLE_MSGBOX, "Would you like to...", "Would you like us to set your account a security question?\n\n* This can be used to recover your account in-case you have forgotten your password.", "Yes", "No");
8031 return 1;
8032}
8033
8034function:LoginPlayer(playerid)
8035{
8036 new Query[900], DBResult:Result;
8037 static string[900];
8038 string[0] = 0;
8039
8040 format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(pName(playerid)));
8041 Result = db_query(Database, Query);
8042 if(db_num_rows(Result))
8043 {
8044 User[playerid][accountID] = db_get_field_assoc_int(Result, "userid");
8045
8046 SetPlayerScore(playerid, db_get_field_assoc_int(Result, "score"));
8047 GivePlayerMoney(playerid, db_get_field_assoc_int(Result, "money"));
8048
8049 User[playerid][accountKills] = db_get_field_assoc_int(Result, "kills");
8050 User[playerid][accountDeaths] = db_get_field_assoc_int(Result, "deaths");
8051 User[playerid][accountAdmin] = db_get_field_assoc_int(Result, "admin");
8052 db_get_field_assoc(Result, "joindate", User[playerid][accountDate], 64);
8053
8054 User[playerid][accountWarn] = db_get_field_assoc_int(Result, "warn");
8055 User[playerid][accountMuted] = db_get_field_assoc_int(Result, "mute");
8056 User[playerid][accountMuteSec] = db_get_field_assoc_int(Result, "mutesec");
8057 User[playerid][accountCMuted] = db_get_field_assoc_int(Result, "cmute");
8058 User[playerid][accountCMuteSec] = db_get_field_assoc_int(Result, "cmutesec");
8059 User[playerid][accountJail] = db_get_field_assoc_int(Result, "jail");
8060 User[playerid][accountJailSec] = db_get_field_assoc_int(Result, "jailsec");
8061 User[playerid][accountGame][2] = db_get_field_assoc_int(Result, "hours");
8062 User[playerid][accountGame][1] = db_get_field_assoc_int(Result, "minutes");
8063 User[playerid][accountGame][0] = db_get_field_assoc_int(Result, "seconds");
8064 User[playerid][accountChocolate] = db_get_field_assoc_int(Result, "chocolate");
8065 User[playerid][accountSkin] = db_get_field_assoc_int(Result, "skin");
8066 User[playerid][accountUseSkin] = db_get_field_assoc_int(Result, "useskin");
8067 User[playerid][accountPM] = db_get_field_assoc_int(Result, "togpm");
8068 User[playerid][accountCage] = db_get_field_assoc_int(Result, "cage");
8069
8070 db_get_field_assoc(Result, "laston", User[playerid][accountLastOn], 32);
8071
8072 User[playerid][accountLogged] = true;
8073
8074 if(User[playerid][accountMuted] == 1)
8075 {
8076 format(string, sizeof(string), "** You have been muted from using the chat for %d seconds, You are muted the last time you logged out.", User[playerid][accountMuteSec]);
8077 SendClientMessage(playerid, COLOR_RED, string);
8078 }
8079 if(User[playerid][accountCMuted] == 1)
8080 {
8081 format(string, sizeof(string), "** You have been muted from using the commands for %d seconds, You are muted the last time you logged out.", User[playerid][accountCMuteSec]);
8082 SendClientMessage(playerid, COLOR_RED, string);
8083 }
8084
8085 SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You have successfully logged in to the server.");
8086 if(User[playerid][accountAdmin] >= 1)
8087 {
8088 format(string, sizeof(string), "* You have logged in the server as %s.", GetAdminRank(User[playerid][accountAdmin]));
8089 SendClientMessage(playerid, -1, string);
8090 }
8091
8092 format(string, sizeof(string), "Welcome Back, %s!\nYou have logged in to the server, your last login was %s.\n\n"white"Admin Level: "green"(%d)\n\n"white"Score: %d\nCash: $%d\n\n"grey"You may close this dialouge.", pName(playerid), User[playerid][accountLastOn], User[playerid][accountAdmin], GetPlayerScore(playerid), GetPlayerMoney(playerid));
8093 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Welcome Back!", string, "Close", "");
8094
8095 PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
8096 }
8097 db_free_result(Result);
8098 return 1;
8099}
8100
8101function:IsValidPassword( const password[ ] )
8102{
8103 for( new i = 0; password[ i ] != EOS; ++i )
8104 {
8105 switch( password[ i ] )
8106 {
8107 case '0'..'9', 'A'..'Z', 'a'..'z': continue;
8108 default: return 0;
8109 }
8110 }
8111 return 1;
8112}
8113
8114stock DB_Escape(text[])
8115{
8116 new
8117 ret[80* 2],
8118 ch,
8119 i,
8120 j;
8121 while ((ch = text[i++]) && j < sizeof (ret))
8122 {
8123 if (ch == '\'')
8124 {
8125 if (j < sizeof (ret) - 2)
8126 {
8127 ret[j++] = '\'';
8128 ret[j++] = '\'';
8129 }
8130 }
8131 else if (j < sizeof (ret))
8132 {
8133 ret[j++] = ch;
8134 }
8135 else
8136 {
8137 j++;
8138 }
8139 }
8140 ret[sizeof (ret) - 1] = '\0';
8141 return ret;
8142}
8143
8144stock CheckBan(ip[])
8145{
8146 new string[20];
8147 new File: file = fopen("JakAdmin/ban.ini", io_read);
8148 while(fread(file, string))
8149 {
8150 if (strcmp(ip, string, true, strlen(ip)) == 0)
8151 {
8152 fclose(file);
8153 return 1;
8154 }
8155 }
8156 fclose(file);
8157 return 0;
8158}
8159
8160stock AddBan(ip[])
8161{
8162 if (!CheckBan(ip))
8163 {
8164 new File: file = fopen("JakAdmin/ban.ini", io_append);
8165 new string[300];
8166 format(string, sizeof(string), "\r\n%s", ip);
8167 fwrite(file, string);
8168 fclose(file);
8169 return 1;
8170 }
8171 return 0;
8172}
8173
8174stock RemoveBan(ip[])
8175{
8176 if (CheckBan(ip))
8177 {
8178 new string[20];
8179 new File: file = fopen("JakAdmin/ban.ini", io_read);
8180 new File: file2 = fopen("JakAdmin/tempBan.ini", io_append);
8181 while(fread(file, string))
8182 {
8183 if (strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\r\n", string) != 0)
8184 {
8185 fwrite(file2, string);
8186 }
8187 }
8188 fclose(file);
8189 fclose(file2);
8190 file = fopen("JakAdmin/ban.ini", io_write);
8191 file2 = fopen("JakAdmin/tempBan.ini", io_read);
8192 while(fread(file2, string))
8193 {
8194 fwrite(file, string);
8195 }
8196 fclose(file);
8197 fclose(file2);
8198 fremove("JakAdmin/tempBan.ini");
8199 return 1;
8200 }
8201 return 0;
8202}
8203
8204stock ShowBan(playerid, banid = -1, admin[] = "JakAdmin", reason[] = "69 Sex", when[] = "01/01/1970 00:00:00", days = 36135)
8205{
8206 new string[256], string2[1500];
8207
8208 for(new i=0; i<100; i++)
8209 {
8210 SendClientMessage(playerid, -1, " ");
8211 }
8212
8213 format(string, 256, "* You are banned by %s for the following reasons:", admin);
8214 SendClientMessage(playerid, COLOR_RED, string);
8215 format(string, 256, "(( %s ))", reason);
8216 SendClientMessage(playerid, -1, string);
8217 format(string, 256, "* IP Address: [%s] - Banned Since: [%s]", User[playerid][accountIP], when);
8218 SendClientMessage(playerid, -1, string);
8219
8220 strcat(string2, ""grey"");
8221 strcat(string2, "You are banned from this server.:\n\n");
8222 format(string, 256, ""white"Ban ID: "red"#%d\n", banid);
8223 strcat(string2, string);
8224 format(string, 256, ""white"Name: "red"%s\n", pName(playerid));
8225 strcat(string2, string);
8226 format(string, 256, ""white"Banned By: "red"%s\n", admin);
8227 strcat(string2, string);
8228 format(string, 256, ""white"Reason: "red"%s\n", reason);
8229 strcat(string2, string);
8230 format(string, 256, ""white"IP: "red"%s\n", User[playerid][accountIP]);
8231 strcat(string2, string);
8232 format(string, 256, ""white"Banned since: "red"%s\n", when);
8233 strcat(string2, string);
8234 if(days == 36135 || days == 340703845)
8235 {
8236 format(string, 256, ""white"Expires in: "red"Never\n\n");
8237 strcat(string2, string);
8238 }
8239 else
8240 {
8241 new datestring[32];
8242 datestring = ConvertTimestamp(days, 4);
8243 format(string, 256, ""white"Expires in: "red"%s\n\n", datestring);
8244 strcat(string2, string);
8245 }
8246 strcat(string2, ""grey"");
8247 strcat(string2, "If you think this is an error or a false ban, submit a ban appeal on forums.\n");
8248 strcat(string2, "Press F8 to take a quick-screenshot of your ban details.");
8249
8250 Dialog_Show(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"You are banned from this server.", string2, "Close", "");
8251 return 1;
8252}
8253
8254stock UnbanAccountEx(playerid)
8255{
8256 new string[128], DBResult:Result, Query[129], fIP[30];
8257
8258 format(Query, sizeof(Query), "SELECT * FROM `bans` WHERE `username` = '%s'", pName(playerid));
8259 Result = db_query(Database, Query);
8260
8261 if(db_num_rows(Result))
8262 {
8263 db_get_field_assoc(Result, "ip", fIP, 30);
8264 RemoveBan(fIP);
8265
8266 format(Query, sizeof(Query), "DELETE FROM `bans` WHERE `username` = '%s'", DB_Escape(pName(playerid)));
8267 db_query(Database, Query);
8268
8269 format(string, sizeof string, "** %s temporary-ban has expired.", pName(playerid));
8270 SendAdmin(COLOR_GREEN, string);
8271 print(string);
8272 SaveLog("banlog.txt", string);
8273
8274 OnPlayerConnect(playerid);
8275 SendClientMessage(playerid, COLOR_GREEN, "Your temporary ban has expired.");
8276 }
8277 db_free_result(Result);
8278 return 1;
8279}
8280
8281stock UnbanAccount(playerid, name[])
8282{
8283 new string[128], DBResult:Result, Query[129], fIP[30];
8284 format(Query, sizeof(Query), "SELECT * FROM `bans` WHERE `username` = '%s'", name);
8285 Result = db_query(Database, Query);
8286
8287 if(db_num_rows(Result))
8288 {
8289 db_get_field_assoc(Result, "ip", fIP, 30);
8290 RemoveBan(fIP);
8291
8292 format(Query, sizeof(Query), "DELETE FROM `bans` WHERE `username` = '%s'", DB_Escape(name));
8293 db_query(Database, Query);
8294
8295 format(string, sizeof string, "ADMIN: %s (IP: %s) was unbanned by %s.", name, fIP, pName(playerid));
8296 SendAdmin(COLOR_GREEN, string);
8297 print(string);
8298 SaveLog("banlog.txt", string);
8299 }
8300 else
8301 {
8302 format(string, sizeof(string), "* Account: %s is not in the database.", name);
8303 SendClientMessage(playerid, COLOR_RED, string);
8304 }
8305 db_free_result(Result);
8306 return 1;
8307}
8308
8309stock BanAccountEx(name[], ip[], admin[] = "Anticheat", reason[] = "None", days = 36135)
8310{
8311 new Query[500], ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[32], daysFinal;
8312 daysFinal = gettime() + 60*60*24*days;
8313 if(!days) daysFinal = 340703845;
8314
8315 gettime(ban_hr, ban_min, ban_sec);
8316 getdate(ban_years, ban_month, ban_days);
8317
8318 format(when, sizeof(when), "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
8319
8320 AddBan(ip);
8321
8322 format(Query, sizeof(Query), "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`, `temporary_ban`) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", DB_Escape(name), DB_Escape(ip), DB_Escape(admin), DB_Escape(reason), DB_Escape(when), daysFinal);
8323 db_query(Database, Query);
8324 return 1;
8325}
8326
8327stock BanAccount(playerid, admin[] = "Anticheat", reason[] = "None", days = 36135)
8328{
8329 new Query[500], DBResult:result, ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[32], daysFinal;
8330 daysFinal = gettime() + 60*60*24*days;
8331 if(!days) daysFinal = 340703845;
8332
8333 gettime(ban_hr, ban_min, ban_sec);
8334 getdate(ban_years, ban_month, ban_days);
8335
8336 format(when, sizeof(when), "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
8337
8338 AddBan(User[playerid][accountIP]);
8339
8340 format(Query, sizeof(Query), "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`, `temporary_ban`) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), DB_Escape(admin), DB_Escape(reason), DB_Escape(when), daysFinal);
8341 db_query(Database, Query);
8342
8343 result = db_query(Database, "SELECT last_insert_rowid()");
8344 SetPVarInt(playerid, "ban_id", db_get_field_int(result));
8345 db_free_result(result);
8346 return 1;
8347}
8348
8349function:IsValidWeapon(weaponid)
8350{
8351 if (weaponid > 0 && weaponid < 19 || weaponid > 21 && weaponid < 47) return 1;
8352 return 0;
8353}
8354
8355function:SaveLog(filename[], text[])
8356{
8357 if(!ServerInfo[SaveLogs])
8358 return 0;
8359
8360 new string[256];
8361
8362 if(!fexist(_LOG_))
8363 {
8364 printf("[JakAdmin] Unable to overwrite '%s' at the '%s', '%s' missing.", filename, _LOG_, _LOG_);
8365 print("No logs has been saved to your server database.");
8366
8367 format(string, sizeof string, "JakAdmin has attempted to overwrite '%s' at the '%s' which is missing.", filename, _LOG_);
8368 SendAdmin(COLOR_RED, string);
8369 return SendAdmin(-1, "No logs has been saved to the server database, Check the console for further solution.");
8370 }
8371
8372 new File:file, filepath[128];
8373
8374 new year, month, day;
8375 new hour, minute, second;
8376
8377 getdate(year, month, day);
8378 gettime(hour, minute, second);
8379 format(filepath, sizeof(filepath), ""_LOG_"%s", filename);
8380 file = fopen(filepath, io_append);
8381 format(string, sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n", month, day, year, hour, minute, second, text);
8382 fwrite(file, string);
8383 fclose(file);
8384 return 1;
8385}
8386
8387stock VehicleOccupied(vehicleid)
8388{
8389 foreach(new i : Player) if(IsPlayerInVehicle(i, vehicleid))
8390 {
8391 return 1;
8392 }
8393 return 0;
8394}
8395
8396stock DataExist(name[])
8397{
8398 new Buffer[180],
8399 Entry,
8400 DBResult:Result
8401 ;
8402
8403 format(Buffer, sizeof(Buffer), "SELECT `userid` FROM `users` WHERE `username` = '%s'", name);
8404 Result = db_query(Database, Buffer);
8405
8406 if(db_num_rows(Result))
8407 {
8408 Entry = 1;
8409 db_free_result(Result);
8410 }
8411 else Entry = 0;
8412 return Entry;
8413}
8414
8415stock SendAdmin(color, string[])
8416{
8417 foreach(new i : Player) if(User[i][accountAdmin] > 0)
8418 {
8419 SendClientMessage(i, color, string);
8420 }
8421 return 1;
8422}
8423
8424stock StartSpectate(playerid, specplayerid)
8425{
8426 SetPlayerInterior(playerid, GetPlayerInterior(specplayerid));
8427 TogglePlayerSpectating(playerid, 1);
8428
8429 if(IsPlayerInAnyVehicle(specplayerid))
8430 {
8431 PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
8432 User[playerid][SpecID] = specplayerid;
8433 User[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
8434 }
8435 else
8436 {
8437 PlayerSpectatePlayer(playerid, specplayerid);
8438 User[playerid][SpecID] = specplayerid;
8439 User[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
8440 }
8441 return 1;
8442}
8443
8444stock StopSpectate(playerid)
8445{
8446 TogglePlayerSpectating(playerid, 0);
8447 User[playerid][SpecID] = INVALID_PLAYER_ID;
8448 User[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
8449 GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
8450 return 1;
8451}
8452
8453stock AdvanceSpectate(playerid)
8454{
8455 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
8456 {
8457 for(new id = User[playerid][SpecID] + 1, j = GetPlayerPoolSize(); id <= j; id++)
8458 {
8459 if(playerid == id) continue;
8460
8461 if(GetPlayerState(id) == PLAYER_STATE_SPECTATING && User[id][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(id) != 1 && GetPlayerState(id) != 2 && GetPlayerState(id) != 3))
8462 {
8463 continue;
8464 }
8465 else
8466 {
8467 if(IsPlayerConnected(id))
8468 {
8469 StartSpectate(playerid, id);
8470 break;
8471
8472 }
8473 else
8474 {
8475 continue;
8476 }
8477 }
8478 }
8479 }
8480 return 1;
8481}
8482
8483stock ReverseSpectate(playerid)
8484{
8485 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
8486 {
8487 for(new id = User[playerid][SpecID] - 1; id >= 0; id-- )
8488 {
8489 if(playerid == id) continue;
8490
8491 if(GetPlayerState(id) == PLAYER_STATE_SPECTATING && User[id][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(id) != 1 && GetPlayerState(id) != 2 && GetPlayerState(id) != 3))
8492 {
8493 continue;
8494 }
8495 else
8496 {
8497 if(IsPlayerConnected(id))
8498 {
8499 StartSpectate(playerid, id);
8500 break;
8501
8502 }
8503 else
8504 {
8505 continue;
8506 }
8507 }
8508 }
8509 }
8510 return 1;
8511}
8512
8513stock GetVehicleModelIDFromName(vname[])
8514{
8515 for(new i = 0; i < 211; i++)
8516 {
8517 if ( strfind(VehicleNames[i], vname, true) != -1 )
8518 return i + 400;
8519 }
8520 return -1;
8521}
8522
8523function:EraseVeh(vehicleid)
8524{
8525 foreach(new i : Player) if(IsPlayerInVehicle(i, vehicleid))
8526 {
8527 new Float:X, Float:Y, Float:Z;
8528 RemovePlayerFromVehicle(i);
8529 GetPlayerPos(i, X, Y, Z);
8530 SetPlayerPos(i, X, Y+3, Z);
8531 }
8532 SetTimerEx("VehRes", 1500, 0, "i", vehicleid);
8533}
8534
8535function:DelVehicle(vehicleid)
8536{
8537 foreach(new players : Player) if(IsPlayerInVehicle(players, vehicleid))
8538 {
8539 new Float:X, Float:Y, Float:Z;
8540 GetPlayerPos(players, X, Y, Z);
8541 SetPlayerPos(players, X, Y, Z+2);
8542 SetVehicleToRespawn(vehicleid);
8543 }
8544 SetTimerEx("VehRes", 3000, 0, "d", vehicleid);
8545 return 1;
8546}
8547
8548stock Config(form = 0, playerid = INVALID_PLAYER_ID)
8549{
8550 new string[128];
8551
8552 if(!form)
8553 {
8554 print("\n****************************************************************");
8555 print("Black Stunting Configuration...");
8556 printf("Registration Optional: %s | SaveLogs: %s | AutoLogin: %s | ReadCmd: %s", (ServerInfo[RegisterOption]) ? ("Yes") : ("No"), (ServerInfo[SaveLogs]) ? ("Yes") : ("No"), (ServerInfo[AutoLogin]) ? ("Yes") : ("No"), (ServerInfo[ReadCmds]) ? ("Yes") : ("No"));
8557 printf("ReadCmdMode: %s | LogTires: %d | SecurityQuesTires: %d", (ServerInfo[ReadCmd]) ? ("Spectate") : ("Normal"), ServerInfo[LoginWarn], ServerInfo[SecureWarn]);
8558 printf("AntiName: %s | AntiAd: %s | AntiSpam: %s | ReadPM: %s", (ServerInfo[AntiName]) ? ("Yes") : ("No"), (ServerInfo[AntiAd]) ? ("Yes") : ("No"), (ServerInfo[AntiSpam]) ? ("Yes") : ("No"), (ServerInfo[ReadPMs]) ? ("Yes") : ("No"));
8559 printf("AntiSwear: %s | TabKick: %d | IdleKick: %d", (ServerInfo[AntiSwear]) ? ("Yes") : ("No"), ServerInfo[TabTime], ServerInfo[AFKTime]);
8560 printf("Admin: (1) %s, (2) %s, (3) %s, (4) %s, (5) %s", ServerInfo[AdminRank1], ServerInfo[AdminRank2], ServerInfo[AdminRank3], ServerInfo[AdminRank4], ServerInfo[AdminRank5]);
8561 print("****************************************************************");
8562 }
8563 else
8564 {
8565 SendClientMessage(playerid, -1, "________________________________________________________________");
8566 SendClientMessage(playerid, -1, " ");
8567 SendClientMessage(playerid, COLOR_GREEN, "Black Stunting Configurations...");
8568 format(string, sizeof(string), "Registration Optional: %s | SaveLogs: %s | AutoLogin: %s | ReadCmd: %s", (ServerInfo[RegisterOption]) ? ("Yes") : ("No"), (ServerInfo[SaveLogs]) ? ("Yes") : ("No"), (ServerInfo[AutoLogin]) ? ("Yes") : ("No"), (ServerInfo[ReadCmds]) ? ("Yes") : ("No"));
8569 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
8570 format(string, sizeof(string), "ReadCmdMode: %s | LogTires: %d | SecurityQuesTires: %d", (ServerInfo[ReadCmd]) ? ("Spectate") : ("Normal"), ServerInfo[LoginWarn], ServerInfo[SecureWarn]);
8571 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
8572 format(string, sizeof(string), "AntiName: %s | AntiAd: %s | AntiSpam: %s | ReadPM: %s", (ServerInfo[AntiName]) ? ("Yes") : ("No"), (ServerInfo[AntiAd]) ? ("Yes") : ("No"), (ServerInfo[AntiSpam]) ? ("Yes") : ("No"), (ServerInfo[ReadPMs]) ? ("Yes") : ("No"));
8573 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
8574 format(string, sizeof(string), "AntiSwear: %s | TabKick: %d | IdleKick: %d", (ServerInfo[AntiSwear]) ? ("Yes") : ("No"), ServerInfo[TabTime], ServerInfo[AFKTime]);
8575 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
8576 if(User[playerid][accountAdmin] >= 4)
8577 {
8578 format(string, sizeof(string), "Admin: (1) %s, (2) %s, (3) %s, (4) %s, (5) %s", ServerInfo[AdminRank1], ServerInfo[AdminRank2], ServerInfo[AdminRank3], ServerInfo[AdminRank4], ServerInfo[AdminRank5]);
8579 SendClientMessage(playerid, COLOR_ORANGE, string);
8580 }
8581 SendClientMessage(playerid, -1, "________________________________________________________________");
8582 }
8583 return 1;
8584}
8585
8586function:VehRes(vehicleid)
8587{
8588 DestroyVehicle(vehicleid);
8589}
8590
8591function:checkfolder()
8592{
8593 if(!fexist("JakAdmin/"))
8594 {
8595 print("\n[JakAdmin] JakAdmin folder doesn't exist in scriptfiles, JakAdmin won't start.");
8596 print("Solution: Create the folder JakAdmin on the scriptfiles.");
8597 return print("Continusly using the script with the missing file will not save the target script objective.\n");
8598 }
8599 if(!fexist("JakAdmin/Logs/"))
8600 {
8601 print("\n[JakAdmin] Logs folder doesn't exist in JakAdmin folder, JakAdmin won't start.");
8602 print("Solution: Create the folder Logs on the JakAdmin folder.");
8603 return print("Continusly using the script with the missing file will not save the target script objective.\n");
8604 }
8605 ////////////////////////////////////////////////////////////////////////////
8606
8607 if(!fexist("JakAdmin/config.ini"))
8608 {
8609 print("\n[JakAdmin] config.ini doesn't exist, JakAdmin has created it for you.");
8610 print("[JakAdmin] config.ini has the default values setted on it, modify it your own.\n");
8611
8612 new INI:file = INI_Open("JakAdmin/config.ini");
8613 /////
8614 INI_WriteInt(file, "RegisterOption", 0);
8615 ServerInfo[RegisterOption] = 0;
8616 /////
8617 INI_WriteInt(file, "SaveLog", 1);
8618 ServerInfo[SaveLogs] = 1;
8619 /////
8620 INI_WriteInt(file, "LoginWarn", 3);
8621 ServerInfo[LoginWarn] = 3;
8622 /////
8623 INI_WriteInt(file, "SecureWarn", 3);
8624 ServerInfo[SecureWarn] = 3;
8625 /////
8626 INI_WriteInt(file, "AutoLogin", 0);
8627 ServerInfo[AutoLogin] = 0;
8628 /////
8629 INI_WriteInt(file, "ReadCmds", 1);
8630 ServerInfo[ReadCmds] = 1;
8631 /////
8632 INI_WriteInt(file, "ReadCmd", 0);
8633 ServerInfo[ReadCmd] = 0;
8634 /////
8635 INI_WriteInt(file, "MaxPing", 0);
8636 ServerInfo[MaxPing] = 0;
8637 /////
8638 INI_WriteInt(file, "AntiSwear", 1);
8639 ServerInfo[AntiSwear] = 1;
8640 /////
8641 INI_WriteInt(file, "AntiName", 1);
8642 ServerInfo[AntiName] = 1;
8643 /////
8644 INI_WriteInt(file, "AntiAd", 1);
8645 ServerInfo[AntiAd] = 1;
8646 /////
8647 INI_WriteInt(file, "AntiSpam", 0);
8648 ServerInfo[AntiSpam] = 0;
8649 /////
8650 INI_WriteInt(file, "TabTime", 0);
8651 ServerInfo[TabTime] = 0;
8652 /////
8653 INI_WriteInt(file, "AFKTime", 0);
8654 ServerInfo[AFKTime] = 0;
8655 /////
8656 INI_WriteInt(file, "ReadPMs", 1);
8657 ServerInfo[ReadPMs] = 1;
8658 /////
8659 INI_WriteInt(file, "LockChat", 0);
8660 ServerInfo[LockChat] = 0;
8661 /////
8662 INI_WriteInt(file, "JoinMsg", 1);
8663 ServerInfo[JoinMsg] = 1;
8664 /////
8665 format(ServerInfo[AdminRank1], 32, "Moderator");
8666 INI_WriteString(file, "AdminRank1", ServerInfo[AdminRank1]);
8667 format(ServerInfo[AdminRank2], 32, "Admin");
8668 INI_WriteString(file, "AdminRank2", ServerInfo[AdminRank2]);
8669 format(ServerInfo[AdminRank3], 32, "Head Admin");
8670 INI_WriteString(file, "AdminRank3", ServerInfo[AdminRank3]);
8671 format(ServerInfo[AdminRank4], 32, "Lead Admin");
8672 INI_WriteString(file, "AdminRank4", ServerInfo[AdminRank4]);
8673 format(ServerInfo[AdminRank5], 32, "Owner");
8674 INI_WriteString(file, "AdminRank5", ServerInfo[AdminRank5]);
8675 INI_Close(file);
8676 }
8677 else if(fexist("JakAdmin/config.ini"))
8678 {
8679 INI_ParseFile("JakAdmin/config.ini", "LoadData");
8680 }
8681
8682 LoadBadNames();
8683 LoadAntiSwear();
8684 return 1;
8685}
8686
8687function:LoadData(name[], value[])
8688{
8689 INI_Int("RegisterOption", ServerInfo[RegisterOption]);
8690 INI_Int("SaveLog", ServerInfo[SaveLogs]);
8691 INI_Int("LoginWarn", ServerInfo[LoginWarn]);
8692 INI_Int("SecureWarn", ServerInfo[SecureWarn]);
8693 INI_Int("AutoLogin", ServerInfo[AutoLogin]);
8694 INI_Int("ReadCmds", ServerInfo[ReadCmds]);
8695 INI_Int("ReadCmd", ServerInfo[ReadCmd]);
8696 INI_Int("MaxPing", ServerInfo[MaxPing]);
8697 INI_Int("AntiSwear", ServerInfo[AntiSwear]);
8698 INI_Int("AntiName", ServerInfo[AntiName]);
8699 INI_Int("AntiAd", ServerInfo[AntiAd]);
8700 INI_Int("AntiSpam", ServerInfo[AntiSpam]);
8701 INI_Int("TabTime", ServerInfo[TabTime]);
8702 INI_Int("AFKTime", ServerInfo[AFKTime]);
8703 INI_Int("ReadPMs", ServerInfo[ReadPMs]);
8704 INI_Int("LockChat", ServerInfo[LockChat]);
8705 INI_Int("JoinMsg", ServerInfo[JoinMsg]);
8706 /////
8707 INI_String("AdminRank1", ServerInfo[AdminRank1], 32);
8708 INI_String("AdminRank2", ServerInfo[AdminRank2], 32);
8709 INI_String("AdminRank3", ServerInfo[AdminRank3], 32);
8710 INI_String("AdminRank4", ServerInfo[AdminRank4], 32);
8711 INI_String("AdminRank5", ServerInfo[AdminRank5], 32);
8712 return 1;
8713}
8714
8715stock LoadBadNames()
8716{
8717 new File:file, string[100];
8718
8719 if(fexist("JakAdmin/ForbiddenNames.cfg"))
8720 {
8721 if((file = fopen("JakAdmin/ForbiddenNames.cfg",io_read)))
8722 {
8723 while(fread(file, string))
8724 {
8725 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
8726 BadNames[BadNameCount] = string;
8727 BadNameCount++;
8728 }
8729 fclose(file);
8730 }
8731 }
8732 else
8733 {
8734 print("\n[JakAdmin] ForbiddenNames.cfg doesn't exist, JakAdmin has created it for you.\n");
8735 fcreate("JakAdmin/ForbiddenNames.cfg");
8736 }
8737 return 1;
8738}
8739
8740stock fcreate(filename[])
8741{
8742 if(fexist(filename))
8743 return 0;
8744
8745 new File:file = fopen(filename, io_write);
8746 return fclose(file);
8747}
8748
8749stock LoadAntiSwear()
8750{
8751 new File:file, string[100];
8752 if(fexist("JakAdmin/ForbiddenWords.cfg"))
8753 {
8754 if((file = fopen("JakAdmin/ForbiddenWords.cfg",io_read)))
8755 {
8756 while(fread(file, string))
8757 {
8758 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
8759 ForbiddenWords[ForbiddenWordCount] = string;
8760 ForbiddenWordCount++;
8761 }
8762 fclose(file);
8763 }
8764 }
8765 else
8766 {
8767 print("\n[JakAdmin] ForbiddenWords.cfg doesn't exist, JakAdmin has created it for you.\n");
8768 fcreate("JakAdmin/ForbiddenWords.cfg");
8769 }
8770 return 1;
8771}
8772
8773function:ShowRanks(playerid)
8774{
8775 new string[128], combine[128 * 10];
8776
8777 strcat(combine, "Rank\tName\n");
8778
8779 format(string, sizeof(string), "Admin Rank #1\t"green"%s\n", ServerInfo[AdminRank1]);
8780 strcat(combine, string);
8781 format(string, sizeof(string), "Admin Rank #2\t"red"%s\n", ServerInfo[AdminRank2]);
8782 strcat(combine, string);
8783 format(string, sizeof(string), "Admin Rank #3\t"green"%s\n", ServerInfo[AdminRank3]);
8784 strcat(combine, string);
8785 format(string, sizeof(string), "Admin Rank #4\t"red"%s\n", ServerInfo[AdminRank4]);
8786 strcat(combine, string);
8787 format(string, sizeof(string), "Admin Rank #5\t"green"%s\n", ServerInfo[AdminRank5]);
8788 strcat(combine, string);
8789
8790 Dialog_Show(playerid, DIALOG_RANKS, DIALOG_STYLE_TABLIST_HEADERS, "Ranks Configuration", combine, "Edit", "Back");
8791 return 1;
8792}
8793
8794function:ShowSettings(playerid)
8795{
8796 static string[128], combine[128 * 11];
8797 string[0] = 0;
8798 combine[0] = 0;
8799
8800 strcat(combine, "Name\tStatus\tInfo\n");
8801
8802 format(string, sizeof(string), "Save Log Files\t%s\tSaves a log files on the scriptfiles (tracks every admin's move)\n", (ServerInfo[SaveLogs] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8803 strcat(combine, string);
8804 format(string, sizeof(string), "Maximum Login Tries\t"grey"%d\tMaximum Login Warning before they get kicked\n", ServerInfo[LoginWarn]);
8805 strcat(combine, string);
8806 format(string, sizeof(string), "Maximum Security Tries\t"grey"%d\tMaximum Security Question Warning before they get kicked\n", ServerInfo[SecureWarn]);
8807 strcat(combine, string);
8808 format(string, sizeof(string), "Auto Login\t%s\tAuto Login's Player upon Connecting "red"(Risky)\n", (ServerInfo[AutoLogin] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8809 strcat(combine, string);
8810 format(string, sizeof(string), "Read Player Commands\t%s\tTracks every player's typed command except for /cpass\n", (ServerInfo[ReadCmds] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8811 strcat(combine, string);
8812 format(string, sizeof(string), "Ping Kicker\t"grey"%d"white"\tKicks the player when reached the maximum ping (0 to disable)\n", ServerInfo[MaxPing]);
8813 strcat(combine, string);
8814 format(string, sizeof(string), "Anti Swearing\t%s\tPrevents player's from swearing if it's on\n", (ServerInfo[AntiSwear] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8815 strcat(combine, string);
8816 format(string, sizeof(string), "Anti Name\t%s\tKick's player who is in the forbidden name's list\n", (ServerInfo[AntiName] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8817 strcat(combine, string);
8818 format(string, sizeof(string), "Anti Advertisement\t%s\tPrevent player from server advertising (e.g. 127.0.0.1:7777)\n", (ServerInfo[AntiAd] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8819 strcat(combine, string);
8820 format(string, sizeof(string), "Anti Spam\t%s\tPrevent player from spamming (e.g. make me admin plz!)\n", (ServerInfo[AntiSpam] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8821 strcat(combine, string);
8822 format(string, sizeof(string), "Read Command Type\t%s\tChanges the Read Command type\n", (ServerInfo[ReadCmd] == 1) ? (""green"Spectate"white"") : (""green"Normal"white""));
8823 strcat(combine, string);
8824 format(string, sizeof(string), "Register Optional\t%s\tMakes the registration in the server optional\n", (ServerInfo[RegisterOption] == 1) ? (""green"Yes"white"") : (""red"No"white""));
8825 strcat(combine, string);
8826 format(string, sizeof(string), "Tabbed Kicker\t%d\tKicks tabbed players (set to 0 to disable)\n", ServerInfo[TabTime]);
8827 strcat(combine, string);
8828 format(string, sizeof(string), "Idle Kicker\t%d\tKicks idled players (set to 0 to disable)\n", ServerInfo[AFKTime]);
8829 strcat(combine, string);
8830 format(string, sizeof(string), "Read PMs\t%s\tAbility to read private messages globally.\n", (ServerInfo[ReadPMs] == 1) ? (""green"Yes"white"") : (""red"No"white""));
8831 strcat(combine, string);
8832 format(string, sizeof(string), "Join/Leave Messages\t%s\tSelf Explanatory.\n", (ServerInfo[JoinMsg] == 1) ? (""green"ON"white"") : (""red"OFF"white""));
8833 strcat(combine, string);
8834 strcat(combine, "Ranks\t"grey"5"white"\tEdit the Admin Ranks here!");
8835 Dialog_Show(playerid, DIALOG_SETTINGS, DIALOG_STYLE_TABLIST_HEADERS, "Black Stunting Configuration", combine, "Edit", "Cancel");
8836 return 1;
8837}
8838
8839stock GetAdminRank(level)
8840{
8841 new name[64];
8842
8843 switch(level)
8844 {
8845 case 1: format(name, 64, ServerInfo[AdminRank1]);
8846 case 2: format(name, 64, ServerInfo[AdminRank2]);
8847 case 3: format(name, 64, ServerInfo[AdminRank3]);
8848 case 4: format(name, 64, ServerInfo[AdminRank4]);
8849 case 5: format(name, 64, ServerInfo[AdminRank5]);
8850 default: format(name, 64, "Player");
8851 }
8852 return name;
8853}
8854
8855function:SaveConfig()
8856{
8857 new INI:file = INI_Open("JakAdmin/config.ini");
8858 INI_WriteInt(file, "RegisterOption", ServerInfo[RegisterOption]);
8859 INI_WriteInt(file, "SaveLog", ServerInfo[SaveLogs]);
8860 INI_WriteInt(file, "LoginWarn", ServerInfo[LoginWarn]);
8861 INI_WriteInt(file, "SecureWarn", ServerInfo[SecureWarn]);
8862 INI_WriteInt(file, "AutoLogin", ServerInfo[AutoLogin]);
8863 INI_WriteInt(file, "ReadCmds", ServerInfo[ReadCmds]);
8864 INI_WriteInt(file, "ReadCmd", ServerInfo[ReadCmd]);
8865 INI_WriteInt(file, "MaxPing", ServerInfo[MaxPing]);
8866 INI_WriteInt(file, "AntiSwear", ServerInfo[AntiSwear]);
8867 INI_WriteInt(file, "AntiName", ServerInfo[AntiName]);
8868 INI_WriteInt(file, "AntiAd", ServerInfo[AntiAd]);
8869 INI_WriteInt(file, "AntiSpam", ServerInfo[AntiSpam]);
8870 INI_WriteInt(file, "TabTime", ServerInfo[TabTime]);
8871 INI_WriteInt(file, "AFKTime", ServerInfo[AFKTime]);
8872 INI_WriteInt(file, "ReadPMs", ServerInfo[ReadPMs]);
8873 INI_WriteInt(file, "LockChat", ServerInfo[LockChat]);
8874 INI_WriteInt(file, "JoinMsg", ServerInfo[JoinMsg]);
8875 INI_WriteString(file, "AdminRank1", ServerInfo[AdminRank1]);
8876 INI_WriteString(file, "AdminRank2", ServerInfo[AdminRank2]);
8877 INI_WriteString(file, "AdminRank3", ServerInfo[AdminRank3]);
8878 INI_WriteString(file, "AdminRank4", ServerInfo[AdminRank4]);
8879 INI_WriteString(file, "AdminRank5", ServerInfo[AdminRank5]);
8880 INI_Close(file);
8881 return 1;
8882}
8883
8884function:UpdateForbidden()
8885{
8886 new File:file2, string[100];
8887
8888 if((file2 = fopen("JakAdmin/ForbiddenNames.cfg",io_read)))
8889 {
8890 while(fread(file2,string))
8891 {
8892 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
8893 BadNames[BadNameCount] = string;
8894 BadNameCount++;
8895 }
8896 fclose(file2);
8897 printf("\n-> %d forbidden names loaded from JakAdmin", BadNameCount);
8898 }
8899
8900 if((file2 = fopen("JakAdmin/ForbiddenWords.cfg",io_read)))
8901 {
8902 while(fread(file2,string))
8903 {
8904 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
8905 ForbiddenWords[ForbiddenWordCount] = string;
8906 ForbiddenWordCount++;
8907 }
8908 fclose(file2);
8909 printf("-> %d forbidden words loaded from JakAdmin", ForbiddenWordCount);
8910 }
8911 return 1;
8912}
8913
8914function:PosAfterSpec(playerid)
8915{
8916 SetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
8917 SetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
8918 SetPlayerInterior(playerid, SpecInt[playerid][0]);
8919 SetPlayerVirtualWorld(playerid, SpecInt[playerid][1]);
8920}
8921
8922// Report System coded by jake elite (01/22/17)
8923function:InsertReport(playerid, targetid, reason[])
8924{
8925 new nextid = -1, string[128], r_hr, r_min, r_sec, r_m, r_d, r_y;
8926
8927 for(new i = 1; i < MAX_REPORTS; i++) // loops through MAX_REPORTs (exception for zero) to find the next unoccupied ID.
8928 {
8929 if(rInfo[i][reportTaken] == false)
8930 {
8931 nextid = i;
8932 break;
8933 }
8934 }
8935
8936 if(nextid < 1) // failed to send the report to admins
8937 {
8938 SendClientMessage(playerid, COLOR_RED, "** We cannot process your report at this moment, Please report again later.");
8939 SendClientMessage(playerid, -1, "** If you still can't /report after 2-4 minutes, File in a report on forum instead.");
8940 }
8941 else
8942 {
8943 getdate(r_y, r_m, r_d);
8944 gettime(r_hr, r_min, r_sec);
8945
8946 rInfo[nextid][reportTaken] = true;
8947 format(rInfo[nextid][reportTime], 32, "%02d-%02d-%d %02d:%02d:%02d", r_m, r_d, r_y, r_hr, r_min, r_sec);
8948 rInfo[nextid][reporterID] = playerid;
8949 rInfo[nextid][reportedID] = targetid;
8950 format(rInfo[nextid][reportReason], 64, reason);
8951 rInfo[nextid][reportAccepted] = INVALID_PLAYER_ID;
8952
8953 format(string, sizeof(string), "[Report] %s(%d) has reported %s(%d) for %s [ReportID: %d]", pName(playerid), playerid, pName(targetid), targetid, reason, nextid);
8954 SendAdmin(COLOR_LIGHTBLUE, string);
8955 print(string);
8956 SaveLog("report.txt", string);
8957
8958 foreach(new i : Player)
8959 {
8960 if(User[i][accountLogged] && User[i][accountAdmin] > 0)
8961 {
8962 GameTextForPlayer(i, "New Report", 1000, 1);
8963 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
8964 }
8965 }
8966
8967 format(string, sizeof(string), "Your complaint against %s (%s) has been sent to admins, Your report is ID %d.", pName(targetid), reason, nextid);
8968 SendClientMessage(playerid, COLOR_YELLOW, string);
8969 }
8970 return 1;
8971}
8972
8973function:HandleReport(playerid, reportid)
8974{
8975 new string[128];
8976
8977 if(User[playerid][accountAdmin] > 0)
8978 {
8979 if(rInfo[reportid][reportTaken] && rInfo[reportid][reportAccepted] == INVALID_PLAYER_ID)
8980 {
8981 format(string, sizeof(string), "* %s is now handling your report against %s (%s)", pName(playerid), pName(rInfo[reportid][reportedID]), rInfo[reportid][reportReason]);
8982 SendClientMessage(rInfo[reportid][reporterID], COLOR_YELLOW, string);
8983 SendClientMessage(rInfo[reportid][reporterID], -1, "* Use /reporttalk to talk to an admin handling your report.");
8984
8985 format(string, sizeof(string), "[Report] %s is now handling the report of %s against %s [Report ID: %d]", pName(playerid), pName(rInfo[reportid][reporterID]), pName(rInfo[reportid][reportedID]), reportid);
8986 SendAdmin(COLOR_GREEN, string);
8987 print(string);
8988 SaveLog("report.txt", string);
8989
8990 rInfo[reportid][reportAccepted] = playerid;
8991 }
8992 }
8993 return 1;
8994}
8995
8996function:DenyReport(playerid, reportid, reason[])
8997{
8998 new string[128];
8999
9000 if(User[playerid][accountAdmin] > 0)
9001 {
9002 if(rInfo[reportid][reportTaken] && rInfo[reportid][reportAccepted] == INVALID_PLAYER_ID)
9003 {
9004 format(string, sizeof(string), "* %s marked your report as invalid against %s (%s)", pName(playerid), pName(rInfo[reportid][reportedID]), rInfo[reportid][reportReason]);
9005 SendClientMessage(rInfo[reportid][reporterID], COLOR_YELLOW, string);
9006 format(string, sizeof(string), "* Admin %s: %s", pName(playerid), reason);
9007 SendClientMessage(rInfo[reportid][reporterID], -1, string);
9008
9009 format(string, sizeof(string), "[Report] Report against %s by %s has been marked invalid by %s [Report ID: %d]", pName(rInfo[reportid][reportedID]), pName(rInfo[reportid][reporterID]), pName(playerid), reportid);
9010 SendAdmin(COLOR_GREEN, string);
9011 print(string);
9012 SaveLog("report.txt", string);
9013
9014 ResetReport(reportid);
9015 }
9016 }
9017 return 1;
9018}
9019
9020function:EndReport(playerid, reportid, reason[])
9021{
9022 new string[128];
9023
9024 if(User[playerid][accountAdmin] >= 1)
9025 {
9026 if(rInfo[reportid][reportTaken] && rInfo[reportid][reportAccepted] == playerid)
9027 {
9028 format(string, sizeof(string), "* %s has closed your report against %s (%s)", pName(playerid), pName(rInfo[reportid][reportedID]), rInfo[reportid][reportReason]);
9029 SendClientMessage(rInfo[reportid][reporterID], COLOR_YELLOW, string);
9030 format(string, sizeof(string), "* Admin %s: %s", pName(playerid), reason);
9031 SendClientMessage(rInfo[reportid][reporterID], -1, string);
9032
9033 format(string, sizeof(string), "[Report] Report against %s by %s has been closed by %s [Report ID: %d]", pName(rInfo[reportid][reportedID]), pName(rInfo[reportid][reporterID]), pName(playerid), reportid);
9034 SendAdmin(COLOR_GREEN, string);
9035 print(string);
9036 SaveLog("report.txt", string);
9037
9038 ResetReport(reportid);
9039 }
9040 }
9041 return 1;
9042}
9043
9044function:ResetReport(reportid)
9045{
9046 new string[128];
9047
9048 if(rInfo[reportid][reportTaken])
9049 {
9050 if(IsPlayerConnected(rInfo[reportid][reportAccepted]) && rInfo[reportid][reportAccepted] != INVALID_PLAYER_ID)
9051 {
9052 format(string, sizeof(string), "* Report ID %d being handled by you has been closed automatically.", reportid);
9053 SendClientMessage(rInfo[reportid][reportAccepted], -1, string);
9054 }
9055
9056 rInfo[reportid][reportTaken] = false;
9057 format(rInfo[reportid][reportTime], 32, "");
9058 rInfo[reportid][reporterID] = INVALID_PLAYER_ID;
9059 rInfo[reportid][reportedID] = INVALID_PLAYER_ID;
9060 format(rInfo[reportid][reportReason], 64, "");
9061 rInfo[reportid][reportAccepted] = INVALID_PLAYER_ID;
9062 }
9063 return 1;
9064}
9065
9066stock RemoveAlpha(color) {
9067 return (color & ~0xFF);
9068}
9069
9070stock AddAlpha(color)
9071{
9072 new newcolor = color - (color & 0x000000FF) + 0xFF;
9073 return newcolor;
9074}
9075
9076stock IsValidIP(ip[])
9077{
9078 new a;
9079 for (new i = 0; i < strlen(ip); i++)
9080 {
9081 if (ip[i] == '.')
9082 {
9083 a++;
9084 }
9085 }
9086 if (a != 3)
9087 {
9088 return 1;
9089 }
9090 return 0;
9091}
9092
9093stock QuickSort_Pair(array[][2], bool:desc, left, right)
9094{
9095 #define PAIR_FIST (0)
9096 #define PAIR_SECOND (1)
9097
9098 new
9099 tempLeft = left,
9100 tempRight = right,
9101 pivot = array[(left + right) / 2][PAIR_FIST],
9102 tempVar
9103 ;
9104
9105 while (tempLeft <= tempRight)
9106 {
9107 if (desc)
9108 {
9109 while (array[tempLeft][PAIR_FIST] > pivot)
9110 tempLeft++;
9111
9112 while (array[tempRight][PAIR_FIST] < pivot)
9113 tempRight--;
9114 }
9115 else
9116 {
9117 while (array[tempLeft][PAIR_FIST] < pivot)
9118 tempLeft++;
9119
9120 while (array[tempRight][PAIR_FIST] > pivot)
9121 tempRight--;
9122 }
9123
9124 if (tempLeft <= tempRight)
9125 {
9126 tempVar = array[tempLeft][PAIR_FIST];
9127 array[tempLeft][PAIR_FIST] = array[tempRight][PAIR_FIST];
9128 array[tempRight][PAIR_FIST] = tempVar;
9129
9130 tempVar = array[tempLeft][PAIR_SECOND];
9131 array[tempLeft][PAIR_SECOND] = array[tempRight][PAIR_SECOND];
9132 array[tempRight][PAIR_SECOND] = tempVar;
9133
9134 tempLeft++;
9135 tempRight--;
9136 }
9137 }
9138
9139 if (left < tempRight)
9140 QuickSort_Pair(array, desc, left, tempRight);
9141
9142 if (tempLeft < right)
9143 QuickSort_Pair(array, desc, tempLeft, right);
9144
9145 #undef PAIR_FIST
9146 #undef PAIR_SECOND
9147}
9148
9149/////////////////////////////// INCLUDE SUPPORT ////////////////////////////////
9150// DO NOT REMOVE
9151
9152function:check_playerafk(playerid)
9153{
9154 SetPVarInt(playerid, "account_afk", User[playerid][accountAFK]);
9155 return 1;
9156}
9157
9158function:check_playertabbed(playerid)
9159{
9160 SetPVarInt(playerid, "account_tabbed", User[playerid][accountTabbed]);
9161 return 1;
9162}
9163
9164function:check_playingtime(playerid)
9165{
9166 SetPVarInt(playerid, "account_hour", User[playerid][accountGame][2]);
9167 SetPVarInt(playerid, "account_minute", User[playerid][accountGame][1]);
9168 SetPVarInt(playerid, "account_second", User[playerid][accountGame][0]);
9169 return 1;
9170}
9171
9172function:set_playingtime(playerid, hour, minute, second)
9173{
9174 User[playerid][accountGame][2] = hour;
9175 User[playerid][accountGame][1] = minute;
9176 User[playerid][accountGame][0] = second;
9177 return 1;
9178}
9179
9180function:check_chocolate(playerid)
9181{
9182 // Checks the chocolate bar the player has.
9183 return User[playerid][accountChocolate];
9184}
9185
9186function:set_chocolate(playerid, amount)
9187{
9188 // Sets the chocolate bar the player has.
9189 User[playerid][accountChocolate] = amount;
9190 return 1;
9191}
9192
9193function:save_player(playerid)
9194{
9195 return SaveData(playerid);
9196}
9197
9198function:check_admin(playerid)
9199{
9200 // Checks the admin level of the player
9201 return User[playerid][accountAdmin];
9202}
9203
9204function:set_admin(playerid, level)
9205{
9206 // Sets the admin level of the player
9207 User[playerid][accountAdmin] = level;
9208 return 1;
9209}
9210
9211function:check_login(playerid)
9212{
9213 // Checks if the player is logged in or not
9214 return User[playerid][accountLogged];
9215}
9216
9217function:set_log(playerid, toggle)
9218{
9219 // Sets the accountLogged to toggle
9220 if(toggle == 0)
9221 {
9222 User[playerid][accountLogged] = 0;
9223 }
9224 else if(toggle >= 1)
9225 {
9226 User[playerid][accountLogged] = 1;
9227 }
9228 return 1;
9229}
9230
9231function:check_mute(playerid)
9232{
9233 // Check if the player is muted or not
9234 return User[playerid][accountMuted];
9235}
9236
9237function:check_mutesec(playerid)
9238{
9239 // Check the player's mute seconds if there is any
9240 return User[playerid][accountMuteSec];
9241}
9242
9243function:check_cmute(playerid)
9244{
9245 // Check if the player is muted or not
9246 return User[playerid][accountCMuted];
9247}
9248
9249function:check_cmutesec(playerid)
9250{
9251 // Check the player's mute seconds if there is any
9252 return User[playerid][accountCMuteSec];
9253}
9254
9255function:set_mute(playerid, toggle)
9256{
9257 // Set the player's mute status
9258 User[playerid][accountMuted] = toggle;
9259 return 1;
9260}
9261
9262function:set_mutesec(playerid, sec)
9263{
9264 // Set the player's mute seconds
9265 User[playerid][accountMuteSec] = sec;
9266 return 1;
9267}
9268
9269function:set_cmute(playerid, toggle)
9270{
9271 // Set the player's command mute status
9272 User[playerid][accountCMuted] = toggle;
9273 return 1;
9274}
9275
9276function:set_cmutesec(playerid, sec)
9277{
9278 // Set the player's command mute seconds
9279 User[playerid][accountCMuteSec] = sec;
9280 return 1;
9281}
9282
9283function:check_jail(playerid)
9284{
9285 // Check the player's jail status
9286 return User[playerid][accountJail];
9287}
9288
9289function:check_jailsec(playerid)
9290{
9291 // Check the player's jail seconds if there is any
9292 return User[playerid][accountJailSec];
9293}
9294
9295function:set_jail(playerid, toggle)
9296{
9297 // Set the player's jail status
9298 User[playerid][accountJail] = toggle;
9299 return 1;
9300}
9301
9302function:set_jailsec(playerid, sec)
9303{
9304 // Set the player's jail seconds
9305 User[playerid][accountJailSec] = sec;
9306 return 1;
9307}
9308
9309function:check_id(playerid)
9310{
9311 return User[playerid][accountID];
9312}
9313
9314function:check_warn(playerid)
9315{
9316 // Check how many warns do the player got
9317 return User[playerid][accountWarn];
9318}
9319
9320function:set_warn(playerid, warn)
9321{
9322 // Sets how many warns to the player
9323 User[playerid][accountWarn] = warn;
9324 return 1;
9325}
9326
9327function:check_kills(playerid)
9328{
9329 // Check how many kills do the player got
9330 return User[playerid][accountKills];
9331}
9332
9333function:set_kill(playerid, kill)
9334{
9335 // Sets how many kills to the player
9336 User[playerid][accountKills] = kill;
9337 return 1;
9338}
9339
9340function:check_deaths(playerid)
9341{
9342 // Check how many deaths do the player got
9343 return User[playerid][accountDeaths];
9344}
9345
9346function:set_death(playerid, death)
9347{
9348 // Sets how many deaths to the player
9349 User[playerid][accountDeaths] = death;
9350 return 1;
9351}
9352
9353/*******************************************************************************
9354 * End of the Script - JakAdmin4.0 (c), 2017 *
9355 ******************************************************************************/