· 10 years ago · Sep 14, 2016, 05:00 PM
1/*******************************************************************************
2********************************************************************************
3
4 ** Jake's Admin System 3.4.1 **
5 Celebrating it's 4th anniversary since
6 RomAdmin's release on 09/09/12
7 ** Last Updated: 09/09/16 **
8
9Changelog for JakAdmin 3.4.1:
10 * IMPORTANT; Fixed VIP System; The VIP level now saves.
11 * Re-worked on the way how JakAdmin3 creates the tables & database.
12 Along with the messy way of how JakAdmin3 inserts a new player data!
13 * Added the VIP level on /stats (Thank you for reminding me Twiix)
14 * /vips command has been added (Again, thanks to Twiix)
15 * Improved the Vehicle Spawn code abit;
16 * Re-touched the script a little bit.
17 * /cpass is now invisible from the Read Commands.
18 * The return of the config.ini, Welcome back dini (Ew)
19 * Removed JakAdmin3 from the register & login dialog.
20 * After reaching the maximum warning on Security Question, you will get kicked!
21 * /stats completely re-designed.
22 * Player's can now change their Security Question and Security Answer.
23 (They have to input their passwords first)
24 * Re-introducing the old Anti-Swear & Anti-Name system of JakAdmin
25 (based off from LAdmin, thanks LethaL!)
26 * Minor fix on /vcmds.
27 * Re-introducing the admin ranks (saved along with config.ini, editable IG, /jsettings)
28 * Re-introducing /admins on dialog, + /vips too!
29 * Admin Chat has been moved back to it's old style (E.G.; #hey guys!)
30 Same goes to VIP Chat.
31 * Kick Delay has been decreased from 2000ms to 800ms.
32 * Added BanID on the ban table (+ improved the ban system a little bit, banning the player's IP as well)
33 * Added a /crash command (* the same as of LAdmin5's /crash)
34 * Removed GetPlayerColor @ /ip.
35 * /cname now renames the player's account.
36 * Typing none on /cquestion now disables the Security Question&Answer all together.
37 (the word none is disabled though on the main setup of Securtiy Question&Answer)
38 * A new anti-advertisement system (thanks to SickAttack)
39
40Credits goes to:
41 * Jake Cipher (Scripting JakAdmin)
42 • Zeex (zcmd)
43 * DracoBlue (dini)
44 • Y_Less (sscanf/YSI/whirlpool)
45 • Lordzy (Second RCON Login)
46 * SickAttack (Anti Advertisement)
47 * Koala818 (RegEx)
48 • SA-MP Team
49 • Others who helped me on beta testing.
50
51********************************************************************************
52*******************************************************************************/
53
54#include <a_samp>
55native WP_Hash(buffer[], len, const str[]);
56#include <dini>
57#include <zcmd>
58#include <sscanf2>
59#include <YSI\y_iterate> // foreach
60#include <libRegEx>
61
62native IsValidVehicle(vehicleid);
63
64#pragma dynamic 2934092
65
66//============================================================================//
67
68// Macros
69
70//Public Macro
71#define function:%0(%1) forward %0(%1);\
72 public %0(%1)
73
74//Level Check Macro
75#define LevelCheck(%0,%1); \
76 if(User[(%0)][accountAdmin] < %1 && !IsPlayerAdmin((%0)))\
77 return format(st, 90, "* You must be level %d to use this command.", (%1)),\
78 SendClientMessage((%0), COLOR_RED, st);
79
80//Login Check Macro
81#define LoginCheck(%1) if(User[%1][accountLogged] == 0) return SendClientMessage(%1, COLOR_RED, "* You must be logged in to use this command.")
82
83#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
84
85////////////////////////////////////////////////////////////////////////////////
86
87// Defines
88
89//Colors
90
91#define white "{FFFFFF}"
92#define lightblue "{33CCFF}"
93#define grey "{AFAFAF}"
94#define orange "{FF8000}"
95#define black "{2C2727}"
96#define red "{FF0000}"
97#define yellow "{FFFF00}"
98#define green "{33CC33}"
99#define blue "{0080FF}"
100#define purple "{D526D9}"
101#define pink "{FF80FF}"
102#define brown "{A52A2A}"
103
104#define COLOR_RED 0xFF0000C8
105#define COLOR_YELLOW 0xFFFF00AA
106#define COLOR_GREEN 0x33CC33C8
107#define COLOR_ORANGE 0xFF8000C8
108#define COLOR_WHITE 0xFFFFFFFF
109#define COLOR_PURPLE 0xD526D9FF
110#define COLOR_LIGHTGREEN 0x00FF00FF
111#define COLOR_PINK 0xFF80FFFF
112#define COLOR_LIGHTBLUE 0x33CCFFAA
113#define COLOR_GREY 0xAFAFAFAA
114#define COLOR_BLUE 0x0080FFC8
115#define COLOR_BROWN 0xA52A2AAA
116#define COLOR_BLACK 0x2C2727AA
117
118//Do not change the file type to .ini, We uses SQLite.
119#define _DB_ "JakAdmin3/juser.db"
120//The location and folder has been changed on 3.3.
121
122#define _LOG_ "JakAdmin3/Logs/"
123//The location and folder for the log has been also changed on 3.3.
124
125#define VERSION "3.4.1"
126
127#define ADMIN_SPEC_TYPE_NONE 0
128#define ADMIN_SPEC_TYPE_PLAYER 1
129#define ADMIN_SPEC_TYPE_VEHICLE 2
130
131#define STARTING_SCORE 1
132//Starting score for registered player.
133#define STARTING_CASH 10000
134//Starting cash for registered player.
135#define MAX_RCON_WARNINGS 3
136//Max warnings for attempting to logged in RCON.
137#define REGISTER_DIALOG true
138//Change to false if you want to disable the register/login dialog.
139#define RconProtect true
140//Change to false if you want to disable the 2nd Rcon.
141#define VipSystem true
142//Change to false if you want to disable the VipSystem
143#define SPAM_MAX_MSGS 5 // Max Spam Messages
144#define SPAM_TIMELIMIT 8 // In seconds
145
146#if RconProtect == true
147 #define RconPass "1121"
148 //Password for the 2nd Rcon, changeme to anything you want.
149#endif
150
151#if VipSystem == true
152 #define VipCheck(%0,%1); \
153 if(accountVip[(%0)] < %1)\
154 return format(st, 90, "* You must be VIP level %d to use this command.", (%1)),\
155 SendClientMessage((%0), COLOR_RED, st);
156#endif
157
158// Dialogs
159
160//Dialog Begin is null, You can use it as a message displayer since it is not used.
161#define DIALOG_BEGIN 905
162//Change the dialog id of the DIALOG_BEGIN if it conflicts.
163#define DIALOG_REGISTER DIALOG_BEGIN+1
164#define DIALOG_LOGIN DIALOG_BEGIN+2
165#define DIALOG_COLORS DIALOG_BEGIN+3
166#define DIALOG_RCON DIALOG_BEGIN+4
167#define DIALOG_QUESTION DIALOG_BEGIN+5
168#define DIALOG_ANSWER DIALOG_BEGIN+6
169#define DIALOG_FORGET DIALOG_BEGIN+7
170#define DIALOG_WOULDYOU DIALOG_BEGIN+8
171#define DIALOG_SETTINGS DIALOG_BEGIN+9
172#define DIALOG_LOG_TRIES DIALOG_BEGIN+10
173#define DIALOG_SEC_TRIES DIALOG_BEGIN+11
174#define DIALOG_PING DIALOG_BEGIN+12
175#define DIALOG_PING_WARN DIALOG_BEGIN+13
176#define DIALOG_QUESTION2 DIALOG_BEGIN+14
177#define DIALOG_ANSWER2 DIALOG_BEGIN+15
178#define DIALOG_RANKS DIALOG_BEGIN+16
179#define DIALOG_EDIT_ADMIN_1 DIALOG_BEGIN+17
180#define DIALOG_EDIT_ADMIN_2 DIALOG_BEGIN+18
181#define DIALOG_EDIT_ADMIN_3 DIALOG_BEGIN+19
182#define DIALOG_EDIT_ADMIN_4 DIALOG_BEGIN+20
183#define DIALOG_EDIT_ADMIN_5 DIALOG_BEGIN+21
184#define DIALOG_EDIT_VIP_1 DIALOG_BEGIN+22
185#define DIALOG_EDIT_VIP_2 DIALOG_BEGIN+23
186#define DIALOG_EDIT_VIP_3 DIALOG_BEGIN+24
187
188////////////////////////////////////////////////////////////////////////////////
189
190// Enums
191
192enum ServerData
193{
194 LoginWarn,
195 SecureWarn,
196 SaveLogs,
197 AutoLogin,
198 ReadCmds,
199 MaxPing,
200 AntiSwear,
201 AntiName,
202 AntiAd,
203 AntiSpam,
204 MaxPingWarn,
205 #if VipSystem == true
206 VipRank1[256],
207 VipRank2[256],
208 VipRank3[256],
209 #endif
210 AdminRank1[256],
211 AdminRank2[256],
212 AdminRank3[256],
213 AdminRank4[256],
214 AdminRank5[256]
215};
216
217enum PlayerInfo
218{
219 accountID,
220 accountName[24],
221 accountIP[20],
222 accountQuestion[92],
223 accountAnswer[129],
224 accountPassword[129],
225 accountAdmin,
226 accountKills,
227 accountDeaths,
228 accountScore,
229 accountCash,
230 accountLogged,
231 WarnLog,
232 accountDate[150],
233 accountWarn,
234 accountMuted,
235 accountMuteSec,
236 accountCMuted,
237 accountCMuteSec,
238 accountJail,
239 accountJailSec,
240 SpecID,
241 SpecType,
242 pCar,
243 accountGame[3],
244 pDuty,
245 SpamCount,
246 SpamTime
247};
248
249// Arrays
250
251new VehicleNames[212][] = {
252 {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
253 {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
254 {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
255 {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
256 {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
257 {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
258 {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
259 {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
260 {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
261 {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
262 {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
263 {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
264 {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
265 {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
266 {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
267 {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
268 {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
269 {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
270 {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
271 {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
272 {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
273 {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
274 {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
275 {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
276 {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
277 {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
278 {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
279 {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
280 {"Utility Trailer"}
281};
282
283new User[MAX_PLAYERS][PlayerInfo];
284new ServerInfo[ServerData];
285
286new BadNames[100][100],
287 BadNameCount = 0,
288 ForbiddenWords[100][100],
289 ForbiddenWordCount = 0;
290
291// Variables
292
293new vipsys,
294 DB:Database,
295 static_Warn[MAX_PLAYERS]
296;
297
298#if VipSystem == true
299 new accountVip[MAX_PLAYERS];
300#endif
301
302#if RconProtect == true
303 #include <OPRL>
304 //Includes the OPRL by Lordzy if 2nd_Rcon is set to true.
305 new bool:_RCON[MAX_PLAYERS];
306 new _RCONwarn[MAX_PLAYERS];
307#endif
308
309stock st[90];
310
311new _God[MAX_PLAYERS];
312new reportmsg[4][136];
313
314new SpecInt[MAX_PLAYERS][2];
315new Float:SpecPos[MAX_PLAYERS][4];
316
317//============================================================================//
318
319//Script line starts here
320
321public OnFilterScriptInit()
322{
323 new
324 day,
325 month,
326 year,
327 hour,
328 sec,
329 mins,
330 result = GetTickCount()
331 ;
332
333 getdate(year, month, day);
334 gettime(hour, mins, sec);
335
336 // Checks the JakAdmin3 and logs folder if exist, otherwise sends a print message.
337 checkfolder();
338
339 if(checkfolderEx())
340 {
341 printf("\nJakAdmin %s (c), Copyright - 2016", VERSION);
342 print("4th anniversary release, Version 3.4.1");
343 print("SA-MP 0.3.7 Stability Updates + few fixes on the script\n");
344
345 //Load the .DB file.
346 loadb();
347 printf("[JakAdmin3] Duration: %i ms", (GetTickCount() - result));
348 printf("[JakAdmin3] Date: %02i/%02i/%02i | Time: %02d:%02d:%02d", day, month, year, hour, mins, sec);
349 Config();
350
351 //Syncing Timers
352 SetTimer("SyncStats", 1000, true);
353 //Ping Timer (if set to true)
354 SetTimer("PingCheck", 1000, true);
355 //Punishment Timer Handler
356 SetTimer("PunishmentHandle", 1000, true);
357 //GamePlay
358 SetTimer("GamePlay", 1000, true);
359
360 for(new i=0; i<4; i++)
361 {
362 format(reportmsg[i], 136, "None");
363 }
364
365 foreach(new i : Player)
366 {
367 OnPlayerConnect(i);
368 }
369 }
370 return 1;
371}
372
373public OnFilterScriptExit()
374{
375 //Closing the .DB file.
376 closedb();
377
378 foreach(new i : Player)
379 {
380 if(IsValidVehicle(User[i][pCar]))
381 {
382 DestroyVehicle(User[i][pCar]);
383 }
384 OnPlayerDisconnect(i, 1);
385 User[i][accountLogged] = 0;
386 }
387 return 1;
388}
389
390function:PunishmentHandle()
391{
392 new string[128+50];
393
394 foreach(new i : Player)
395 {
396 if(User[i][accountJail] == 1)
397 {
398 if(User[i][accountJailSec] >= 1)
399 {
400 User[i][accountJailSec] --;
401 }
402 else if(User[i][accountJailSec] == 0)
403 {
404 User[i][accountJail] = 0;
405 format(string, sizeof(string), "** %s(ID:%d) has been unjailed from Admin's Jail.", pName(i), i);
406 SendClientMessageToAll(COLOR_GREY, string);
407 SpawnPlayer(i);
408 }
409 }
410 if(User[i][accountMuted] == 1)
411 {
412 if(User[i][accountMuteSec] >= 1)
413 {
414 User[i][accountMuteSec] --;
415 }
416 else if(User[i][accountMuteSec] == 0)
417 {
418 User[i][accountMuted] = 0;
419 format(string, sizeof(string), "** %s(ID:%d) has been unmuted from Admin's Mute.", pName(i), i);
420 SendClientMessageToAll(COLOR_GREY, string);
421 }
422 }
423 if(User[i][accountCMuted] == 1)
424 {
425 if(User[i][accountCMuteSec] >= 1)
426 {
427 User[i][accountCMuteSec] --;
428 }
429 else if(User[i][accountCMuteSec] == 0)
430 {
431 User[i][accountCMuted] = 0;
432 format(string, sizeof(string), "** %s(ID:%d) has been unmuted from Admin's Command Mute.", pName(i), i);
433 SendClientMessageToAll(COLOR_GREY, string);
434 }
435 }
436 }
437 return 1;
438}
439
440function:PingCheck()
441{
442 new
443 string[130]
444 ;
445
446 foreach(new i : Player)
447 {
448 if(GetPlayerPing(i) > ServerInfo[MaxPing] && ServerInfo[MaxPing])
449 {
450 static_Warn[i] ++;
451 if(static_Warn[i] >= ServerInfo[MaxPingWarn])
452 {
453 format(string, sizeof(string), "** %s(ID:%d) has been automatically kicked by the reason [Reason: High Ping] (Ping: %d | Maximum Ping: %d)", pName(i), i, GetPlayerPing(i), ServerInfo[MaxPing]);
454 SendClientMessageToAll(COLOR_GREY, string);
455 KickDelay(i);
456 return 0;
457 }
458 format(string, sizeof(string), "** %s(ID:%d) has received a Ping Kick Warning (Ping: %d | Maximum Ping: %d) (Warnings: %d/%d)", pName(i), i, GetPlayerPing(i), ServerInfo[MaxPing], static_Warn[i], ServerInfo[MaxPingWarn]);
459 SendClientMessageToAll(COLOR_YELLOW, string);
460 }
461 }
462 return 1;
463}
464
465function:SyncStats()
466{
467 foreach(new i : Player)
468 {
469 if(User[i][accountLogged] == 1)
470 {
471 User[i][accountCash] = GetPlayerMoney(i);
472 User[i][accountScore] = GetPlayerScore(i);
473 }
474
475 //Will be using for god too. (Improving it on the next version)
476 if(_God[i] == 1)
477 {
478 SetPlayerHealth(i, 100000);
479 }
480 }
481 return 1;
482}
483
484function:GamePlay()
485{
486 foreach(new playerid : Player)
487 {
488 if(User[playerid][accountLogged] == 1)
489 {
490 User[playerid][accountGame][0] += 1;
491 if(User[playerid][accountGame][0] == 60)
492 {
493 User[playerid][accountGame][0] = 0;
494 User[playerid][accountGame][1] += 1;
495 if(User[playerid][accountGame][1] >= 59 && User[playerid][accountGame][0] == 0)
496 {
497 User[playerid][accountGame][1] = 0;
498 User[playerid][accountGame][2] += 1;
499 }
500 }
501 }
502 }
503 return 1;
504}
505
506public OnPlayerConnect(playerid)
507{
508 new
509 bQuery[128 * 2],
510 reason[128],
511 admin[128],
512 when[128],
513 DBResult:jResult
514 ;
515
516 new
517 Query[128 * 2],
518 DBResult: Result,
519 fIP[20]
520 ;
521
522 new string[128];
523
524 if(ServerInfo[AntiName])
525 {
526 for(new s = 0; s < BadNameCount; s++)
527 {
528 if(!strcmp(BadNames[s], pName(playerid), true))
529 {
530 format(string, sizeof string, "** Player %s(ID:%d) has been kicked by the Server (Forbidden Name)", pName(playerid), playerid);
531 SendClientMessageToAll(COLOR_GREY, string);
532 printf(string);
533 SaveLog("kicklog.txt", string);
534 KickDelay(playerid);
535 return 1;
536 }
537 }
538 }
539
540 for(new x; x < _: PlayerInfo; ++x ) User[playerid][PlayerInfo: x] = 0;
541 User[playerid][SpecID] = INVALID_PLAYER_ID;
542
543 #if RconProtect == true
544 _RCON[playerid] = false;
545 _RCONwarn[playerid] = 0;
546 #endif
547
548 User[playerid][pDuty] = 0;
549 User[playerid][SpamCount] = 0;
550 User[playerid][SpamTime] = 0;
551
552 #if VipSystem == true
553 accountVip[playerid] = 0;
554 #endif
555
556 _God[playerid] = 0;
557
558 GetPlayerName(playerid, User[playerid][accountName], MAX_PLAYER_NAME);
559 GetPlayerIp(playerid, User[playerid][accountIP], 20);
560
561 static_Warn[playerid] = 0;
562
563 format(bQuery, 600, "SELECT * FROM `bans` WHERE `username` = '%s'", pName(playerid));
564 jResult = db_query(Database, bQuery);
565
566 if(db_num_rows(jResult) && CheckBan(User[playerid][accountIP]))
567 {
568 db_get_field_assoc(jResult, "banid", admin, sizeof(admin));
569 SetPVarInt(playerid, "ban_id", strval(admin));
570 db_get_field_assoc(jResult, "banby", admin, 128);
571 db_get_field_assoc(jResult, "banreason", reason, 128);
572 db_get_field_assoc(jResult, "banwhen", when, 128);
573
574 ShowBan(playerid, GetPVarInt(playerid, "ban_id"), admin, reason, when);
575
576 KickDelay(playerid);
577 return 1;
578 }
579 else if(db_num_rows(jResult) && !CheckBan(User[playerid][accountIP]))
580 {
581 db_get_field_assoc(jResult, "banid", admin, sizeof(admin));
582 SetPVarInt(playerid, "ban_id", strval(admin));
583 db_get_field_assoc(jResult, "banby", admin, 128);
584 db_get_field_assoc(jResult, "banreason", reason, 128);
585 db_get_field_assoc(jResult, "banwhen", when, 128);
586
587 ShowBan(playerid, GetPVarInt(playerid, "ban_id"), admin, reason, when);
588
589 KickDelay(playerid);
590 return 1;
591 }
592 else if(!db_num_rows(jResult) && CheckBan(User[playerid][accountIP]))
593 {
594 SendClientMessage(playerid, COLOR_RED, "* Your IP is banned from this server ; (JakAdmin3)");
595 BanAccount(playerid, "JakAdmin3", "IP Banned");
596
597 KickDelay(playerid);
598 return 1;
599 }
600 db_free_result(jResult);
601
602 if(ServerInfo[AutoLogin])
603 {
604 format(Query, sizeof(Query), "SELECT `password`, `question`, `answer`, `IP` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
605 Result = db_query(Database, Query);
606 }
607 else
608 {
609 format(Query, sizeof(Query), "SELECT `password`, `question`, `answer` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
610 Result = db_query(Database, Query);
611 }
612
613 if(db_num_rows(Result))
614 {
615 db_get_field_assoc(Result, "password", User[playerid][accountPassword], 129);
616 db_get_field_assoc(Result, "question", User[playerid][accountQuestion], 92);
617 db_get_field_assoc(Result, "answer", User[playerid][accountAnswer], 129);
618
619 if(ServerInfo[AutoLogin])
620 {
621 db_get_field_assoc(Result, "IP", fIP, 20);
622 if(strcmp(fIP, User[playerid][accountIP], true) == 0)
623 {
624 SendClientMessage(playerid, -1, "You have been auto logged in.");
625 LoginPlayer(playerid);
626 }
627 else
628 {
629 #if REGISTER_DIALOG == true
630 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
631 {
632 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\n* Press forgot if you forget your password.", "Login", "Quit");
633 }
634 else
635 {
636 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\n* Press forgot if you forget your password.", "Login", "Forget");
637 }
638 #else
639 SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
640 #endif
641 }
642 }
643 else
644 {
645 #if REGISTER_DIALOG == true
646 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
647 {
648 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\n* Press forgot if you forget your password.", "Login", "Quit");
649 }
650 else
651 {
652 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\n* Press forgot if you forget your password.", "Login", "Forget");
653 }
654 #else
655 SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
656 #endif
657 }
658 }
659 else
660 {
661 #if REGISTER_DIALOG == true
662 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.", "Register", "Quit");
663 #else
664 SendClientMessage(playerid, COLOR_ORANGE, "REGISTER: /register [password] to register your account.");
665 #endif
666 }
667 db_free_result(Result);
668 return 1;
669}
670
671public OnPlayerDisconnect(playerid, reason)
672{
673 for(new x=0; x<MAX_PLAYERS; x++)
674 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
675 AdvanceSpectate(x);
676
677 if(IsValidVehicle(User[playerid][pCar])) EraseVeh(User[playerid][pCar]);
678
679 if(User[playerid][accountLogged] == 1)
680 {
681 //Saves the statistics to the .db.
682 SaveData(playerid);
683 }
684 return 1;
685}
686
687public OnPlayerSpawn(playerid)
688{
689 if(User[playerid][accountJail] == 1)
690 {
691 SetTimerEx("JailPlayer", 3000, 0, "d", playerid);
692 SendClientMessage(playerid, COLOR_RED, "PUNISHMENT: You cannot escape your punishment. You are still jailed, Hah!");
693 }
694 return 1;
695}
696
697function:JailPlayer(playerid)
698{
699 new string[128];
700
701 SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
702 SetPlayerInterior(playerid, 3);
703 SetCameraBehindPlayer(playerid);
704
705 format(string, 200, "You have been placed in the jail for %d seconds.", User[playerid][accountJailSec]);
706 SendClientMessage(playerid, COLOR_RED, string);
707 return 1;
708}
709
710public OnPlayerDeath(playerid, killerid, reason)
711{
712 for(new x=0; x<MAX_PLAYERS; x++)
713 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
714 AdvanceSpectate(x);
715
716 User[playerid][accountDeaths] ++;
717 if(killerid != INVALID_PLAYER_ID)
718 {
719 User[killerid][accountKills] ++;
720 }
721 return 1;
722}
723
724public OnVehicleSpawn(vehicleid)
725{
726 foreach(new i : Player)
727 {
728 if(vehicleid == User[i][pCar])
729 {
730 EraseVeh(vehicleid);
731 }
732 }
733 return 1;
734}
735
736public OnVehicleDeath(vehicleid, killerid)
737{
738 return 1;
739}
740
741public OnPlayerText(playerid, text[])
742{
743 new string[178];
744
745 if(ServerInfo[AntiAd] && User[playerid][accountAdmin] < 3)
746 {
747 if(IsAdvertisement(text))
748 {
749 format(string, sizeof(string), "ALERT: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, text);
750 foreach(new i : Player)
751 {
752 if(User[i][accountLogged] == 1)
753 {
754 if(User[i][accountAdmin] >= 1)
755 {
756 SendClientMessage(i, COLOR_RED, string);
757 }
758 }
759 }
760 SendClientMessage(playerid, -1, "Your chat has been sent.");
761 return 0;
762 }
763 }
764
765 if(User[playerid][accountMuted] == 1)
766 {
767 format(string, sizeof(string), "You are still muted, You can talk after %d seconds.", User[playerid][accountMuteSec]);
768 SendClientMessage(playerid, COLOR_ORANGE, string);
769 return 0;
770 }
771
772 if(ServerInfo[AntiSpam])
773 {
774 if((User[playerid][accountAdmin] == 0 && !IsPlayerAdmin(playerid)))
775 {
776 if(User[playerid][SpamCount] == 0) User[playerid][SpamTime] = TimeStamp();
777
778 User[playerid][SpamCount]++;
779 if(TimeStamp() - User[playerid][SpamTime] > SPAM_TIMELIMIT)
780 {
781 User[playerid][SpamCount] = 0;
782 User[playerid][SpamTime] = TimeStamp();
783 }
784 else if(User[playerid][SpamCount] == SPAM_MAX_MSGS)
785 {
786 format(string, sizeof(string), "** Player %s (ID:%d) has been automatically kicked by Server (Flood/Spam Protection)", pName(playerid), playerid);
787 SendClientMessageToAll(COLOR_GREY, string);
788 print(string);
789 SaveLog("kicklog.txt", string);
790 KickDelay(playerid);
791 }
792 else if(User[playerid][SpamCount] == SPAM_MAX_MSGS-1)
793 {
794 SendClientMessage(playerid, COLOR_RED, "WARNING: Stop spamming, your next warn is a kick!");
795 return 0;
796 }
797 }
798 }
799
800 if(text[0] == '#' && User[playerid][accountAdmin] >= 1)
801 {
802 format(string, sizeof( string ), "[AdminChat]"white" %s %s: %s", GetAdminRank(User[playerid][accountAdmin]), pName(playerid), text[1]);
803 SendAdmin(COLOR_YELLOW, string);
804
805 SaveLog("adminchat.txt", string);
806 return 0;
807 }
808 #if VipSystem == true
809 if(text[0] == '$' && accountVip[playerid] >= 1)
810 {
811 format(string, sizeof( string ), "[VIPChat]"white" %s %s: %s", GetVIPRank(accountVip[playerid]), pName(playerid), text[1]);
812
813 SaveLog("vipchat.txt", string);
814
815 foreach(new i : Player)
816 {
817 if(User[i][accountLogged] == 1)
818 {
819 if(accountVip[i] >= 1)
820 {
821 SendClientMessage(i, COLOR_ORANGE, string);
822 }
823 }
824 }
825 return 0;
826 }
827 #endif
828
829 if(ServerInfo[AntiSwear])
830 {
831 for(new s = 0; s < ForbiddenWordCount; s++)
832 {
833 new pos;
834 while((pos = strfind(text,ForbiddenWords[s],true)) != -1) for(new i = pos, j = pos + strlen(ForbiddenWords[s]); i < j; i++) text[i] = '*';
835 }
836 }
837 return 1;
838}
839
840//============================================================================//
841// ZCMD //
842
843public OnPlayerCommandReceived(playerid, cmdtext[])
844{
845 new string[128+50];
846
847 if(ServerInfo[AntiAd])
848 {
849 if(IsAdvertisement(cmdtext))
850 {
851 format(string, sizeof(string), "ALERT: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, cmdtext);
852 foreach(new i : Player)
853 {
854 if(User[i][accountLogged] == 1)
855 {
856 if(User[i][accountAdmin] >= 1)
857 {
858 SendClientMessage(i, COLOR_RED, string);
859 }
860 }
861 }
862 SendClientMessage(playerid, -1, "Your command has been successfully sent.");
863 return 0;
864 }
865 }
866
867 if(User[playerid][accountCMuted] == 1)
868 {
869 format(string, sizeof(string), "You are still muted, You can use all the commands after %d seconds.", User[playerid][accountCMuteSec]);
870 SendClientMessage(playerid, COLOR_ORANGE, string);
871 return 0;
872 }
873
874 if(ServerInfo[ReadCmds])
875 {
876 if(strfind(cmdtext, "cpass", false) != -1) { }
877 else
878 {
879 format(string, sizeof(string), "*** %s(ID:%d) : '%s'", pName(playerid), playerid, cmdtext);
880 foreach(new i : Player)
881 {
882 if(User[i][accountAdmin] >= 1 && User[i][accountAdmin] > User[playerid][accountAdmin] && i != playerid)
883 {
884 SendClientMessage(i, COLOR_GREY, string);
885 }
886 }
887 }
888 }
889 return 1;
890}
891
892#if VipSystem == true
893
894//============================================================================//
895// VIP Level 1-3 //
896//============================================================================//
897
898 CMD:vcmds(playerid, params[])
899 {
900 new string[128 * 10], cb[64];
901
902 LoginCheck(playerid);
903 VipCheck(playerid, 1);
904
905 if(accountVip[playerid] >= 1)
906 {
907 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[VipRank1]);
908 strcat(string, cb);
909 strcat(string, ""white"");
910 strcat(string, "* /vgoto /vsay\n");
911 strcat(string, "*** {D0AEEB}VIP Chat: $ (Usage; $Hi I am JaKe)\n\n");
912 }
913 if(accountVip[playerid] >= 2)
914 {
915 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[VipRank2]);
916 strcat(string, cb);
917 strcat(string, ""white"");
918 strcat(string, "* /vbike /vcar\n\n");
919 }
920 if(accountVip[playerid] >= 3)
921 {
922 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[VipRank3]);
923 strcat(string, cb);
924 strcat(string, ""white"");
925 strcat(string, "* /vweaps /vgod\n\n");
926 }
927
928 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""grey"VIP Commands", string, "Close", "");
929 return 1;
930 }
931
932//============================================================================//
933// VIP Level 1 //
934//============================================================================//
935
936 CMD:vgoto(playerid, params[])
937 {
938 LoginCheck(playerid);
939 VipCheck(playerid, 1);
940
941 new id, string[128], Float:x, Float:y, Float:z;
942
943 if(sscanf(params, "u", id))
944 return SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [playerid]");
945
946 if(id == INVALID_PLAYER_ID)
947 return SendClientMessage(playerid, COLOR_RED, "Player not connected.");
948
949 GetPlayerPos(id, x, y, z);
950
951 SetPlayerInterior(playerid, GetPlayerInterior(id));
952 SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
953
954 if(GetPlayerState(playerid) == 2)
955 {
956 SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
957 LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
958 SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
959 }
960 else SetPlayerPos(playerid, x+2, y, z);
961
962 format(string, sizeof(string), "You have been teleported to %s.", pName(id));
963 SendClientMessage(playerid, COLOR_ORANGE, string);
964 format(string, sizeof(string), "VIP %s has teleported to you.", pName(playerid));
965 SendClientMessage(playerid, COLOR_ORANGE, string);
966 return 1;
967 }
968
969 CMD:vsay(playerid, params[])
970 {
971 LoginCheck(playerid);
972 VipCheck(playerid, 1);
973
974 new
975 string[128]
976 ;
977
978 if(isnull(params))
979 return SendClientMessage(playerid, COLOR_RED, "USAGE: /vsay [message as vsay]");
980
981 format(string, sizeof(string), "** VIP %s: %s", pName(playerid), params);
982 SendClientMessageToAll(COLOR_ORANGE, string);
983 return 1;
984 }
985
986//============================================================================//
987// VIP Level 2 //
988//============================================================================//
989
990 CMD:vbike(playerid, params[])
991 {
992 LoginCheck(playerid);
993 VipCheck(playerid, 2);
994
995 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(playerid))
996 EraseVeh(User[playerid][pCar]);
997 new VehicleID;
998 new Float:X, Float:Y, Float:Z;
999 new Float:Angle, int1;
1000 GetPlayerPos(playerid, X, Y, Z);
1001 GetPlayerFacingAngle(playerid, Angle);
1002 int1 = GetPlayerInterior(playerid);
1003 VehicleID = CreateVehicle(522, X+3,Y,Z, Angle, random(255), random(255), -1);
1004 LinkVehicleToInterior(VehicleID, int1);
1005 SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
1006 User[playerid][pCar] = VehicleID;
1007 SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have spawned an NRG.");
1008 return 1;
1009 }
1010
1011 CMD:vcar(playerid, params[])
1012 {
1013 LoginCheck(playerid);
1014 VipCheck(playerid, 2);
1015
1016 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(playerid))
1017 EraseVeh(User[playerid][pCar]);
1018 new VehicleID;
1019 new Float:X, Float:Y, Float:Z;
1020 new Float:Angle, int1;
1021 GetPlayerPos(playerid, X, Y, Z);
1022 GetPlayerFacingAngle(playerid, Angle);
1023 int1 = GetPlayerInterior(playerid);
1024 VehicleID = CreateVehicle(411, X+3,Y,Z, Angle, random(255), random(255), -1);
1025 LinkVehicleToInterior(VehicleID, int1);
1026 SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
1027 User[playerid][pCar] = VehicleID;
1028 SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have spawned an Infernus.");
1029 return 1;
1030 }
1031
1032//============================================================================//
1033// VIP Level 3 //
1034//============================================================================//
1035
1036 CMD:vgod(playerid, params[])
1037 {
1038 LoginCheck(playerid);
1039 VipCheck(playerid, 3);
1040
1041 if(_God[playerid] == 0)
1042 {
1043 //Removal of the weapons has been made.
1044 SendClientMessage(playerid, COLOR_GREEN, "God Mode On!");
1045 _God[playerid] = 1;
1046 }
1047 else if(_God[playerid] == 1)
1048 {
1049 _God[playerid] = 0;
1050 SendClientMessage(playerid, COLOR_RED, "God Mode Off!");
1051 SetPlayerHealth(playerid, 100.0);
1052 }
1053 return 1;
1054 }
1055
1056 CMD:vweaps(playerid, params[])
1057 {
1058 LoginCheck(playerid);
1059 VipCheck(playerid, 3);
1060 GivePlayerWeapon(playerid, 30, 999999);
1061 GivePlayerWeapon(playerid, 26, 999999);
1062 GivePlayerWeapon(playerid, 8, 999999);
1063
1064 SendClientMessage(playerid, -1, "You have received the {FF8000}VIP weapons{FFFFFF}.");
1065 return 1;
1066 }
1067
1068#endif
1069
1070//============================================================================//
1071// Administrative Level 1-5 //
1072//============================================================================//
1073
1074CMD:jacmds(playerid, params[])
1075{
1076 new string[1446], cb[64];
1077
1078 LoginCheck(playerid);
1079 LevelCheck(playerid, 1);
1080
1081 if(User[playerid][accountAdmin] >= 1)
1082 {
1083 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank1]);
1084 strcat(string, cb);
1085 strcat(string, ""white"");
1086 strcat(string, "* /announce /kick /asay /a(Admin Chat) /settime /setweather /goto /ip /spawn /gotoco /flip /warn\n");
1087 strcat(string, "* /remwarn /addnos /repair /reports /aduty /weaps\n");
1088 strcat(string, "*** {D0AEEB}Admin Chat: # (Usage; #Hi I am JaKe)\n\n");
1089 }
1090 if(User[playerid][accountAdmin] >= 2)
1091 {
1092 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank2]);
1093 strcat(string, cb);
1094 strcat(string, ""white"");
1095 strcat(string, "* /disarm /explode /setinterior /setworld /heal /armour /clearchat /setskin /mute /unmute /(un)jail\n");
1096 strcat(string, "* /akill /spec(off) /car /carcolor /eject /setvhealth /givecar /muted /jailed (/un)jail /show\n");
1097 strcat(string, "* /aweapons /jetpack /carpjob\n\n");
1098 }
1099 if(User[playerid][accountAdmin] >= 3)
1100 {
1101 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank3]);
1102 strcat(string, cb);
1103 strcat(string, ""white"");
1104 strcat(string, "* /setmoney /setscore /setcolor /slap /cname /(un)ban /giveweapon (/un)freeze /getall /bankrupt\n");
1105 strcat(string, "* /armourall /god /teleplayer /destroycar /sethealth /setfstyle /healall /armourall /force\n");
1106 strcat(string, "* /write /get /oban, /jsettings, /forbidword, /crash\n\n");
1107 }
1108 if(User[playerid][accountAdmin] >= 4)
1109 {
1110 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank4]);
1111 strcat(string, cb);
1112 strcat(string, ""white"");
1113 strcat(string, "* /saveallstats /cleardwindow /respawncars /setallweather /setalltime /giveallweapon\n");
1114 strcat(string, "* /giveallcash /giveallscore /setallworld /setallinterior /kickall /disarmall /ejectall\n");
1115 strcat(string, "* /mutecmd /unmutecmd /setallskin /fakedeath /cmdmuted /killall /slapall /explodeall\n");
1116 strcat(string, "* /gmx\n\n");
1117 }
1118 if(User[playerid][accountAdmin] >= 5 || IsPlayerAdmin(playerid))
1119 {
1120 format(cb, sizeof(cb), ""lightblue"-> %s\n", ServerInfo[AdminRank5]);
1121 strcat(string, cb);
1122 strcat(string, ""white"");
1123 #if VipSystem == false
1124 strcat(string, "* /setlevel /fakechat /fakecmd /removeacc /makemegodadmin");
1125 #else
1126 strcat(string, "* /setlevel /fakechat /fakecmd /removeacc /makemegodadmin /setvip");
1127 #endif
1128 }
1129
1130 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""grey"Admin Commands", string, "Close", "");
1131 return 1;
1132}
1133
1134//============================================================================//
1135// Administrative Level One //
1136//============================================================================//
1137
1138CMD:weaps(playerid, params[])
1139{
1140 LoginCheck(playerid);
1141 LevelCheck(playerid, 1);
1142
1143 new
1144 id,
1145 Count,
1146 x,
1147 string[128],
1148 string2[64],
1149 WeapName[24],
1150 slot,
1151 weap,
1152 ammo
1153 ;
1154 if(sscanf(params, "u", id))
1155 return SendClientMessage(playerid, COLOR_RED, "USAGE: /weaps [playerid]");
1156
1157 if(id == INVALID_PLAYER_ID)
1158 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1159
1160 format(string2, sizeof(string2), "_______ [ %s(ID:%d) Weapons ] _______", pName(id), id);
1161 SendClientMessage(playerid, COLOR_WHITE, string2);
1162 for(slot = 0; slot < 14; slot++)
1163 {
1164 GetPlayerWeaponData(id, slot, weap, ammo);
1165 if(ammo != 0 && weap != 0)
1166 Count++;
1167 }
1168 if(Count < 1) return SendClientMessage(playerid, COLOR_RED, "Players has no equipped weapons!");
1169 if(Count >= 1)
1170 {
1171 for (slot = 0; slot < 14; slot++)
1172 {
1173 GetPlayerWeaponData(id, slot, weap, ammo);
1174 if(ammo != 0 && weap != 0)
1175 {
1176 GetWeaponName(weap, WeapName, sizeof(WeapName));
1177 if(ammo == 65535 || ammo == 1)
1178 format(string, sizeof(string), "%s%s (1)",string, WeapName);
1179 else format(string, sizeof(string), "%s%s (%d)", string, WeapName, ammo);
1180 x++;
1181 if(x >= 5)
1182 {
1183 SendClientMessage(playerid, COLOR_YELLOW, string);
1184 x = 0;
1185 format(string, sizeof(string), "");
1186 }
1187 else format(string, sizeof(string), "%s, ", string);
1188 }
1189 }
1190 if(x <= 4 && x > 0)
1191 {
1192 string[strlen(string)-3] = '.';
1193 SendClientMessage(playerid, COLOR_YELLOW, string);
1194 }
1195 }
1196 return 1;
1197}
1198
1199CMD:aduty(playerid, params[])
1200{
1201 LoginCheck(playerid);
1202 LevelCheck(playerid, 1);
1203
1204 new
1205 string[128]
1206 ;
1207
1208 switch(User[playerid][pDuty])
1209 {
1210 case 0:
1211 {
1212 User[playerid][pDuty] = 1;
1213 format(string, 128, "Admin %s(ID:%d) goes on \" Admin Mode \"", pName(playerid), playerid);
1214 SendClientMessageToAll(COLOR_GREEN, string);
1215 }
1216 case 1:
1217 {
1218 User[playerid][pDuty] = 0;
1219 format(string, 128, "Admin %s(ID:%d) goes back on \" Playing Mode \"", pName(playerid), playerid);
1220 SendClientMessageToAll(COLOR_YELLOW, string);
1221 }
1222 }
1223 return 1;
1224}
1225
1226CMD:reports(playerid, params[])
1227{
1228 LoginCheck(playerid);
1229 LevelCheck(playerid, 1);
1230
1231 new string[1400], string2[136];
1232 strcat(string, ""red"*** Report Send by the Players ***\n\n");
1233 strcat(string, ""grey"");
1234 for(new i=0; i<4; i++)
1235 {
1236 format(string2, sizeof string2, "(%d) %s\n", i, reportmsg[i]);
1237 strcat(string, string2);
1238 }
1239
1240 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"Reports", string, "Close", "");
1241 return 1;
1242}
1243
1244CMD:repair(playerid, params[])
1245{
1246 LoginCheck(playerid);
1247 LevelCheck(playerid, 1);
1248
1249 if(IsPlayerInAnyVehicle(playerid))
1250 {
1251 new VehicleID = GetPlayerVehicleID(playerid);
1252 RepairVehicle(VehicleID);
1253 GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~Vehicle ~g~Repaired!", 3000, 3);
1254 SetVehicleHealth(VehicleID, 1000.0);
1255 }
1256 else
1257 SendClientMessage(playerid, COLOR_RED, "* You must be inside of the vehicle to use this command.");
1258 return 1;
1259}
1260
1261CMD:addnos(playerid, params[])
1262{
1263 LoginCheck(playerid);
1264 LevelCheck(playerid, 1);
1265
1266 if(IsPlayerInAnyVehicle(playerid))
1267 {
1268 switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
1269 {
1270 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.");
1271 }
1272 AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
1273 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
1274 }
1275 else
1276 SendClientMessage(playerid, COLOR_RED, "* You must be inside of the vehicle to use this command.");
1277 return 1;
1278}
1279
1280CMD:warn(playerid, params[])
1281{
1282 LoginCheck(playerid);
1283 LevelCheck(playerid, 1);
1284
1285 new
1286 string[128],
1287 id,
1288 reason[128]
1289 ;
1290
1291 if(sscanf(params, "uS(No Reason)[128]", id, reason))
1292 return SendClientMessage(playerid, COLOR_RED, "USAGE: /warn [playerid] [reason]");
1293
1294 if(id == INVALID_PLAYER_ID)
1295 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1296
1297 if(id == playerid)
1298 return SendClientMessage(playerid, COLOR_RED, "* You cannot warn yourself.");
1299
1300 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1301 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1302
1303 User[id][accountWarn] += 1;
1304
1305 format(string, sizeof(string), "Administrator %s(%d) warned %s(%d) for %s (Warnings: %d)", pName(playerid), playerid, pName(id), id, reason, User[id][accountWarn]);
1306 SendClientMessageToAll(COLOR_YELLOW, string);
1307 return 1;
1308}
1309
1310CMD:remwarn(playerid, params[])
1311{
1312 LoginCheck(playerid);
1313 LevelCheck(playerid, 1);
1314
1315 new
1316 string[130],
1317 id
1318 ;
1319
1320 if(sscanf(params, "u", id))
1321 return SendClientMessage(playerid, COLOR_RED, "USAGE: /remwarn [playerid]");
1322
1323 if(id == INVALID_PLAYER_ID)
1324 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1325
1326 if(id == playerid)
1327 return SendClientMessage(playerid, COLOR_RED, "* You cannot remove warn yourself.");
1328
1329 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1330 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1331
1332 if(User[id][accountWarn] == 0)
1333 return SendClientMessage(playerid, COLOR_RED, "* Player has no warnings.");
1334
1335 User[id][accountWarn] -= 1;
1336
1337 format(string, sizeof(string), "Administrator %s(%d) has removed %s(%d) warnings (Warnings Left: %i)", pName(playerid), playerid, pName(id), id, User[id][accountWarn]);
1338 SendClientMessageToAll(COLOR_YELLOW, string);
1339 return 1;
1340}
1341
1342CMD:flip(playerid, params[])
1343{
1344 LoginCheck(playerid);
1345 LevelCheck(playerid, 1);
1346
1347 new id,
1348 string[128],
1349 Float:angle
1350 ;
1351
1352 if(!sscanf(params, "u", id))
1353 {
1354 if(id == INVALID_PLAYER_ID)
1355 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1356
1357 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1358 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1359 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player not in a vehicle.");
1360 GetVehicleZAngle(GetPlayerVehicleID(id), angle);
1361 SetVehicleZAngle(GetPlayerVehicleID(id), angle);
1362
1363 format(string, sizeof(string), "You have flipped Player %s's vehicle.", pName(id));
1364 SendClientMessage(playerid, COLOR_GREEN, string);
1365 format(string, sizeof(string), "Administrator %s has flipped your vehicle.", pName(playerid));
1366 SendClientMessage(id, COLOR_GREEN, string);
1367 }
1368 else
1369 {
1370 if(!IsPlayerInAnyVehicle(playerid))
1371 return SendClientMessage(playerid, COLOR_RED, "* You must be in a vehicle to use /flip.");
1372
1373 GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
1374 SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
1375 SendClientMessage(playerid, COLOR_YELLOW, "Vehicle Flipped!");
1376 SendClientMessage(playerid, -1, "Want to flip player's vehicle? Just do "orange"/flip [playerid]");
1377 }
1378 return 1;
1379}
1380
1381CMD:gotoco(playerid, params[])
1382{
1383 LoginCheck(playerid);
1384 LevelCheck(playerid, 1);
1385
1386 new
1387 Float: Pos[3],
1388 string[128]
1389 ;
1390 if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2]))
1391 return SendClientMessage(playerid, COLOR_RED, "USAGE: /gotoco [x] [y] [z]");
1392
1393 if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
1394 else SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
1395
1396 format(string, sizeof string, "You have teleported to Coordinates %.1f %.1f %.1f", Pos[0], Pos[1], Pos[2]);
1397 SendClientMessage(playerid, COLOR_YELLOW, string);
1398 return 1;
1399}
1400
1401CMD:ip(playerid, params[])
1402{
1403 LoginCheck(playerid);
1404 LevelCheck(playerid, 1);
1405
1406 new
1407 id,
1408 string[120]
1409 ;
1410 if(sscanf(params, "u", id))
1411 return SendClientMessage(playerid, COLOR_RED, "USAGE: /ip [playerid]");
1412
1413 if(id == INVALID_PLAYER_ID)
1414 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1415
1416 format(string, 120, "> %s's IP: %s <", pName(id), getIP(id));
1417 SendClientMessage(playerid, COLOR_YELLOW, string);
1418 return 1;
1419}
1420
1421CMD:spawn(playerid, params[])
1422{
1423 LoginCheck(playerid);
1424 LevelCheck(playerid, 1);
1425
1426 new
1427 string[128],
1428 id
1429 ;
1430
1431 if(sscanf(params, "u", id))
1432 return SendClientMessage(playerid, COLOR_RED, "USAGE: /spawn [playerid]");
1433
1434 if(id == INVALID_PLAYER_ID)
1435 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1436
1437 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1438 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1439
1440 SetPlayerPos(id, 0.0, 0.0, 0.0);
1441 SpawnPlayer(id);
1442 format(string, sizeof(string), "You have respawned Player %s.", pName(id));
1443 SendClientMessage(playerid, -1, string);
1444 format(string, sizeof(string), "Administrator %s has respawned you.", pName(playerid));
1445 SendClientMessage(id, COLOR_YELLOW, string);
1446 return 1;
1447}
1448
1449CMD:goto(playerid, params[])
1450{
1451 LoginCheck(playerid);
1452 LevelCheck(playerid, 1);
1453
1454 new
1455 id,
1456 string[130],
1457 Float:x,
1458 Float:y,
1459 Float:z
1460 ;
1461 if(sscanf(params, "u", id))
1462 return SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [playerid]");
1463
1464 if(id == INVALID_PLAYER_ID)
1465 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1466
1467 GetPlayerPos(id, x, y, z);
1468 SetPlayerInterior(playerid, GetPlayerInterior(id));
1469 SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
1470 if(GetPlayerState(playerid) == 2)
1471 {
1472 SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
1473 LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
1474 SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
1475 }
1476 else SetPlayerPos(playerid, x+2, y, z);
1477 format(string, sizeof(string), "You have been teleported to Player %s.", pName(id));
1478 SendClientMessage(playerid, COLOR_GREEN, string);
1479 format(string, sizeof(string), "Administrator %s has teleported to your location.", pName(playerid));
1480 SendClientMessage(id, COLOR_GREEN, string);
1481 return 1;
1482}
1483
1484CMD:setweather(playerid, params[])
1485{
1486 LoginCheck(playerid);
1487 LevelCheck(playerid, 1);
1488
1489 new
1490 string[130],
1491 id,
1492 weather
1493 ;
1494
1495 if(sscanf(params, "ui", id, weather))
1496 return SendClientMessage(playerid, COLOR_RED, "USAGE: /setweather [playerid] [0/45]");
1497
1498 if(id == INVALID_PLAYER_ID)
1499 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1500
1501 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1502 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1503 if(weather < 0 || weather > 45) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weather ID. (0/45)");
1504 SetPlayerWeather(id, weather);
1505 format(string, sizeof(string), "You have set %s's weather to weatherID %d", pName(id), weather);
1506 SendClientMessage(playerid, COLOR_YELLOW, string);
1507 format(string, sizeof(string), "Administrator %s has your weather to weatherID %d", pName(playerid), weather);
1508 SendClientMessage(id, COLOR_YELLOW, string);
1509 return 1;
1510}
1511
1512CMD:settime(playerid, params[])
1513{
1514 LoginCheck(playerid);
1515 LevelCheck(playerid, 1);
1516
1517 new
1518 string[130],
1519 id,
1520 time
1521 ;
1522
1523 if(sscanf(params, "ui", id, time))
1524 return SendClientMessage(playerid, COLOR_RED, "USAGE: /settime [playerid] [0/23]");
1525
1526 if(id == INVALID_PLAYER_ID)
1527 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1528
1529 if(User[playerid][accountAdmin] < User[id][accountAdmin])
1530 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1531
1532 if(time < 0 || time > 23) return SendClientMessage(playerid, COLOR_RED, "* Invalid Time. (0/23)");
1533 SetPlayerTime(id, time, 0);
1534 format(string, sizeof(string), "You have set %s's screen time to %d:00", pName(id), time);
1535 SendClientMessage(id, COLOR_YELLOW, string);
1536 format(string, sizeof(string), "Administrator %s has set your screen time to %d:00", pName(playerid), time);
1537 SendClientMessage(id, COLOR_YELLOW, string);
1538 return 1;
1539}
1540
1541CMD:announce(playerid, params[])
1542{
1543 LoginCheck(playerid);
1544 LevelCheck(playerid, 1);
1545 if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /announce [message to all]");
1546 GameTextForAll(params, 4000, 3);
1547 return 1;
1548}
1549
1550CMD:kick(playerid, params[])
1551{
1552 LoginCheck(playerid);
1553 LevelCheck(playerid, 1);
1554
1555 new
1556 string[128],
1557 id,
1558 reason[128]
1559 ;
1560 if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /kick [playerid] [reason(Default: N/A)]");
1561 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1562 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1563 format(string, sizeof(string), "** %s has been kicked by Adminstrator %s [Reason: %s]", pName(id), pName(playerid), reason);
1564 SendClientMessageToAll(COLOR_GREY, string);
1565
1566 SaveLog("kicklog.txt", string);
1567
1568 KickDelay(id);
1569 return 1;
1570}
1571
1572CMD:asay(playerid, params[])
1573{
1574 LoginCheck(playerid);
1575 LevelCheck(playerid, 1);
1576
1577 new
1578 string[128]
1579 ;
1580
1581 if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /asay [message as asay]");
1582
1583 format(string, sizeof(string), "** Admin %s: %s", pName(playerid), params);
1584 SendClientMessageToAll(COLOR_GREEN, string);
1585 return 1;
1586}
1587
1588//============================================================================//
1589// Administrative Level Two //
1590//============================================================================//
1591
1592CMD:jetpack(playerid, params[])
1593{
1594 LoginCheck(playerid);
1595 LevelCheck(playerid, 2);
1596
1597 new
1598 id,
1599 string[130]
1600 ;
1601
1602 if(!sscanf(params, "u", id))
1603 {
1604 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1605 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1606 SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
1607 format(string, sizeof(string), "You have given Player %s(ID:%d) a jetpack.", pName(id), id);
1608 SendClientMessage(playerid, COLOR_YELLOW, string);
1609 format(string, sizeof(string), "Administrator %s(ID:%d) has given you a jetpack.", pName(playerid), playerid);
1610 SendClientMessage(id, COLOR_YELLOW, string);
1611 }
1612 else
1613 {
1614 SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
1615 SendClientMessage(playerid, COLOR_YELLOW, "Jetpack Spawned!");
1616 SendClientMessage(playerid, -1, "Want to give player a jetpack? Just do "orange"/jetpack [playerid]");
1617 }
1618 return 1;
1619}
1620
1621CMD:aweapons(playerid, params[])
1622{
1623 LoginCheck(playerid);
1624 LevelCheck(playerid, 2);
1625
1626 GivePlayerWeapon(playerid, 24, 99999);
1627 GivePlayerWeapon(playerid, 26, 99999);
1628 GivePlayerWeapon(playerid, 29, 99999);
1629 GivePlayerWeapon(playerid, 31, 99999);
1630 GivePlayerWeapon(playerid, 33, 99999);
1631 GivePlayerWeapon(playerid, 38, 99999);
1632 GivePlayerWeapon(playerid, 9, 1);
1633
1634 SendClientMessage(playerid, COLOR_YELLOW, "Admin weapons received!");
1635 return 1;
1636}
1637
1638CMD:show(playerid, params[])
1639{
1640 LoginCheck(playerid);
1641 LevelCheck(playerid, 2);
1642
1643 new Player, Show[129];
1644 if(sscanf(params, "us[129]", Player, Show)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /show [playerid] [text]");
1645 if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1646 if(User[playerid][accountAdmin] < User[Player][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1647
1648 GameTextForPlayer(Player, Show, 6000, 3);
1649
1650 new string[120];
1651 format(string, sizeof(string), "Screen text sent to %s(ID:%d).", pName(Player), Player);
1652 SendClientMessage(playerid, COLOR_YELLOW, string);
1653 format(string, sizeof(string), "Administrator %s(ID:%d) has screen text you.", pName(playerid), playerid);
1654 SendClientMessage(Player, COLOR_YELLOW, string);
1655 return 1;
1656}
1657
1658CMD:muted(playerid, params[])
1659{
1660 new string[128], count = 0;
1661
1662 SendClientMessage(playerid, -1, "** "orange"Muted Players "white"**");
1663 foreach(new i : Player)
1664 {
1665 if(User[i][accountLogged] == 1)
1666 {
1667 if(User[i][accountMuted] == 1)
1668 {
1669 format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountMuteSec]);
1670 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
1671 count++;
1672 }
1673 }
1674 }
1675 if(count == 0) return SendClientMessage(playerid, -1, "No muted players at the server.");
1676 return 1;
1677}
1678
1679CMD:jailed(playerid, params[])
1680{
1681 new string[128], count = 0;
1682
1683 SendClientMessage(playerid, -1, "** "orange"Jailed Players "white"**");
1684 foreach(new i : Player)
1685 {
1686 if(User[i][accountLogged] == 1)
1687 {
1688 if(User[i][accountJail] == 1)
1689 {
1690 format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountJailSec]);
1691 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
1692 count++;
1693 }
1694 }
1695 }
1696 if(count == 0) return SendClientMessage(playerid, -1, "No jailed players at the server.");
1697 return 1;
1698}
1699
1700CMD:setvhealth(playerid, params[])
1701{
1702 LoginCheck(playerid);
1703 LevelCheck(playerid, 2);
1704
1705 new
1706 string[130],
1707 id,
1708 hp
1709 ;
1710
1711 if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvhealth [playerid] [health]");
1712 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1713 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1714 new Float:hp2 = float(hp);
1715
1716 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle!");
1717 SetVehicleHealth(GetPlayerVehicleID(id), hp2);
1718
1719 format(string, sizeof(string), "You have set Player's %s(ID:%d) vehicle health to %d", pName(id), id, floatround(hp2));
1720 SendClientMessage(playerid, COLOR_YELLOW, string);
1721 format(string, sizeof(string), "Admin %s(ID:%d) has set your vehicle health to %d", pName(playerid), playerid, floatround(hp2));
1722 SendClientMessage(id, COLOR_YELLOW, string);
1723 return 1;
1724}
1725
1726CMD:eject(playerid, params[])
1727{
1728 LoginCheck(playerid);
1729 LevelCheck(playerid, 2);
1730
1731 new
1732 string[130],
1733 id
1734 ;
1735
1736 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /eject [playerid]");
1737 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1738 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1739 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of the vehicle.");
1740 RemovePlayerFromVehicle(id);
1741 format(string, sizeof(string), "You have ejected %s(ID:%d) from his/HER vehicle", pName(id), id);
1742 SendClientMessage(playerid, COLOR_YELLOW, string);
1743 format(string, sizeof(string), "Admin %s(ID:%d) has ejected you from your vehicle.", pName(playerid), playerid);
1744 SendClientMessage(id, COLOR_YELLOW, string);
1745 return 1;
1746}
1747
1748CMD:carpjob(playerid, params[])
1749{
1750 LoginCheck(playerid);
1751 LevelCheck(playerid, 2);
1752
1753 new
1754 string[130],
1755 id,
1756 pjob
1757 ;
1758 if(sscanf(params, "ui", id, pjob)) return SendClientMessage(playerid, COLOR_RED, "* /carpjob [playerid] [paintjob(0-3)]");
1759 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1760 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1761 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle.");
1762 if(pjob < 0 || pjob > 3) return SendClientMessage(playerid, COLOR_RED, "* Invalid Paintjob ID.");
1763
1764 format(string, sizeof(string), "You have changed the paintjob of %s(ID:%d)'s %s to '%d'", pName(id), id, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
1765 SendClientMessage(playerid, COLOR_GREEN, string);
1766 format(string, sizeof(string), "Admin %s(ID:%d) has changed the paintjob of your %s to '%d'", pName(playerid), playerid, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
1767 SendClientMessage(id, COLOR_YELLOW, string);
1768 ChangeVehiclePaintjob(GetPlayerVehicleID(id), pjob);
1769 return 1;
1770}
1771
1772CMD:carcolor(playerid, params[])
1773{
1774 LoginCheck(playerid);
1775 LevelCheck(playerid, 2);
1776
1777 new
1778 string[130],
1779 id,
1780 col1,
1781 col2
1782 ;
1783 if(sscanf(params, "uiI(255)", id, col1, col2)) return SendClientMessage(playerid, COLOR_RED, "* /carcolor [playerid] [colour1] [colour2(optional)]");
1784 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1785 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1786 if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player must be inside of a vehicle.");
1787
1788 if(col2==255) col2=random(256);
1789
1790 format(string, sizeof(string), "You have changed the color of %s(ID:%d)'s %s to '%d,%d'", pName(id), id, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
1791 SendClientMessage(playerid, COLOR_GREEN, string);
1792 format(string, sizeof(string), "Admin %s(ID:%d) has changed the color of your %s to '%d,%d'", pName(playerid), playerid, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
1793 SendClientMessage(id, COLOR_YELLOW, string);
1794 ChangeVehicleColor(GetPlayerVehicleID(id), col1, col2);
1795 return 1;
1796}
1797
1798CMD:givecar(playerid, params[])
1799{
1800 LoginCheck(playerid);
1801 LevelCheck(playerid, 2);
1802
1803 new string[130],
1804 vID[32],
1805 id,
1806 vVW,
1807 vINT,
1808 vid,
1809 Float:x,
1810 Float:y,
1811 Float:z,
1812 Float:ang,
1813 vehicle,
1814 col1,
1815 col2
1816 ;
1817 if(sscanf(params, "us[32]I(255)I(255)", id, vID, col1, col2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /givecar [playerid] [vehicleid(or name)] [color1(optional)] [color2(optional)]");
1818 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1819 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1820 if(isnumeric(vID)) vid = strval(vID);
1821 else vid = GetVehicleModelIDFromName(vID);
1822 GetPlayerPos(id, x, y, z);
1823 GetPlayerFacingAngle(id, ang);
1824 if(vid < 400 || vid > 611) return SendClientMessage(playerid, COLOR_RED, "* Invalid Vehicle Model ID!");
1825 if(IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "* Player already have a vehicle.");
1826
1827 if(col1==255) col1=random(256);
1828 if(col2==255) col2=random(256);
1829
1830 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(id))
1831 EraseVeh(User[id][pCar]);
1832
1833 vehicle = CreateVehicle(vid, x, y, z, 0, -1, -1, 0);
1834 vVW = GetPlayerVirtualWorld(id);
1835 vINT = GetPlayerInterior(id);
1836 SetVehicleVirtualWorld(vehicle, vVW);
1837 LinkVehicleToInterior(vehicle, vINT);
1838 PutPlayerInVehicle(id, vehicle, 0);
1839 User[id][pCar] = vehicle;
1840 format(string, sizeof(string), "Admin %s(%d) has given you a \"%s\"(%i)", pName(playerid), playerid, VehicleNames[vid - 400], vid);
1841 SendClientMessage(id, COLOR_YELLOW, string);
1842 format(string, sizeof(string), "You have given %s(%d) a \"%s\"(%i)", pName(id), id, VehicleNames[vid - 400], vid);
1843 SendClientMessage(playerid, COLOR_YELLOW, string);
1844 return 1;
1845}
1846
1847CMD:car(playerid, params[])
1848{
1849 LoginCheck(playerid);
1850 LevelCheck(playerid, 2);
1851
1852 new carID[50], car, colour1, colour2, string[128];
1853 if(sscanf(params, "s[50]I(255)I(255)", carID, colour1, colour2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /car [VehicleID(Name)] [Color1(Optional)] [Color2(Optional)]");
1854 if(!isnumeric(carID)) car = GetVehicleModelIDFromName(carID);
1855 else car = strval(carID);
1856 if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_RED, "* Invalid Vehicle Model ID!");
1857
1858 if(colour1==255) colour1=random(256);
1859 if(colour2==255) colour2=random(256);
1860
1861 if(IsValidVehicle(User[playerid][pCar]) && !IsPlayerAdmin(playerid))
1862 EraseVeh(User[playerid][pCar]);
1863 new VehicleID;
1864 new Float:X, Float:Y, Float:Z;
1865 new Float:Angle, int1;
1866 GetPlayerPos(playerid, X, Y, Z);
1867 GetPlayerFacingAngle(playerid, Angle);
1868 int1 = GetPlayerInterior(playerid);
1869 VehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
1870 LinkVehicleToInterior(VehicleID, int1);
1871 SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
1872 User[playerid][pCar] = VehicleID;
1873 format(string, sizeof(string), "You have spawned a \"%s\" (Model: %d) with color %d,%d", VehicleNames[car-400], car, colour1, colour2);
1874 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
1875 return 1;
1876}
1877
1878CMD:spec(playerid, params[])
1879{
1880 LoginCheck(playerid);
1881 LevelCheck(playerid, 2);
1882
1883 new string[150], specplayerid;
1884
1885 if(sscanf(params, "u", specplayerid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /spec [playerid]");
1886 if(specplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1887 if(User[playerid][accountAdmin] < User[specplayerid][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1888 if(specplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot spectate yourself.");
1889 if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && User[specplayerid][SpecID] != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player is spectating someone.");
1890 if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3) return SendClientMessage(playerid, COLOR_RED, "* Player not spawned.");
1891 GetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
1892 GetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
1893 SpecInt[playerid][0] = GetPlayerInterior(playerid);
1894 SpecInt[playerid][1] = GetPlayerVirtualWorld(playerid);
1895 StartSpectate(playerid, specplayerid);
1896 format(string, sizeof(string), "Now Spectating: %s (ID: %d)", pName(specplayerid), specplayerid);
1897 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
1898 SendClientMessage(playerid, -1, "Press SHIFT for Advance Spectating and SPACE for backward spectating.");
1899 return 1;
1900}
1901
1902CMD:specoff(playerid, params[])
1903{
1904 LoginCheck(playerid);
1905 LevelCheck(playerid, 2);
1906
1907 if(User[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
1908 {
1909 StopSpectate(playerid);
1910 SetTimerEx("PosAfterSpec", 3000, 0, "d", playerid);
1911 SendClientMessage(playerid, COLOR_LIGHTBLUE, "No longer spectating.");
1912 }
1913 else return SendClientMessage(playerid, COLOR_RED, "* You are not spectating anyone.");
1914 return 1;
1915}
1916
1917CMD:akill(playerid, params[])
1918{
1919 LoginCheck(playerid);
1920 LevelCheck(playerid, 2);
1921
1922 new
1923 string[150],
1924 reason[128],
1925 id
1926 ;
1927
1928 if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /akill [playerid] [reason(Default: None)]");
1929 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1930 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1931
1932 if(_God[id] == 1)
1933 {
1934 _God[id] = 0;
1935 }
1936
1937 SetPlayerHealth(id, 0.0);
1938 format(string, sizeof(string), "** %s(%d) has been killed by Administrator %s(%d) (Reason: %s)", pName(id), id, pName(playerid), playerid, reason);
1939 SendClientMessageToAll(COLOR_GREY, string);
1940 return 1;
1941}
1942
1943CMD:jail(playerid, params[])
1944{
1945 LoginCheck(playerid);
1946 LevelCheck(playerid, 2);
1947
1948 new id, sec, reason[128], string[250];
1949 if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /jail [playerid] [seconds] [reason]");
1950 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1951 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1952 if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "* You cannot jail lower than 30 seconds.");
1953 if(User[id][accountJail] == 1) return SendClientMessage(playerid, COLOR_RED, "* Player already jailed.");
1954 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
1955
1956 SetCameraBehindPlayer(id);
1957 SetPlayerPos(id, 197.6661, 173.8179, 1003.0234);
1958 SetPlayerInterior(id, 3);
1959
1960 format(string, sizeof(string), "** %s(%d) has been jailed by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
1961 SendClientMessageToAll(COLOR_GREY, string);
1962 SendClientMessage(id, COLOR_ORANGE, "You have been jailed by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
1963
1964 format(string, sizeof(string), "%s has been jailed by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
1965 SaveLog("jail.txt", string);
1966
1967 User[id][accountJail] = 1, User[id][accountJailSec] = sec;
1968 return 1;
1969}
1970
1971CMD:unjail(playerid, params[])
1972{
1973 LoginCheck(playerid);
1974 LevelCheck(playerid, 2);
1975
1976 new id, reason[128], string[250];
1977 if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unjail [playerid] [reason]");
1978 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
1979 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
1980 if(User[id][accountJail] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not in jailed.");
1981 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
1982
1983 format(string, sizeof(string), "** %s(%d) has been unjailed by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
1984 SendClientMessageToAll(COLOR_GREY, string);
1985 SendClientMessage(id, COLOR_ORANGE, "You have been released from jail by an Admin.");
1986
1987 format(string, sizeof(string), "%s has been unjailed by %s for %s", pName(id), pName(playerid), reason);
1988 SaveLog("jail.txt", string);
1989
1990 User[id][accountJail] = 0, User[id][accountJailSec] = 0;
1991 SpawnPlayer(id);
1992 return 1;
1993}
1994
1995CMD:mute(playerid, params[])
1996{
1997 LoginCheck(playerid);
1998 LevelCheck(playerid, 2);
1999
2000 new id, sec, reason[128], string[128+50];
2001 if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /mute [playerid] [seconds] [reason]");
2002 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2003 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2004 if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "* You cannot mute lower than 30 seconds.");
2005 if(User[id][accountMuted] == 1) return SendClientMessage(playerid,COLOR_RED, "* Player already muted.");
2006 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
2007
2008 format(string, sizeof(string), "** %s(%d) has been muted by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
2009 SendClientMessageToAll(COLOR_GREY, string);
2010 SendClientMessage(id, COLOR_ORANGE, "You have been muted by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
2011
2012 format(string, sizeof(string), "%s has been muted by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
2013 SaveLog("mute.txt", string);
2014
2015 User[id][accountMuted] = 1, User[id][accountMuteSec] = sec;
2016 return 1;
2017}
2018
2019CMD:unmute(playerid, params[])
2020{
2021 LoginCheck(playerid);
2022 LevelCheck(playerid, 2);
2023
2024 new id, reason[128], string[250];
2025 if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unmute [playerid] [reason]");
2026 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2027 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2028 if(User[id][accountMuted] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not muted.");
2029 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
2030
2031 format(string, sizeof(string), "* %s(%d) has been unmuted by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
2032 SendClientMessageToAll(COLOR_GREY, string);
2033 SendClientMessage(id, COLOR_ORANGE, "You have been unmuted by an Admin.");
2034
2035 format(string, sizeof(string), "%s has been unmuted by %s", pName(id), pName(playerid));
2036 SaveLog("mute.txt", string);
2037
2038 User[id][accountMuted] = 0, User[id][accountMuteSec] = 0;
2039 return 1;
2040}
2041
2042CMD:setskin(playerid, params[])
2043{
2044 new
2045 string[128+40],
2046 id,
2047 skin
2048 ;
2049
2050 LoginCheck(playerid);
2051 LevelCheck(playerid, 2);
2052
2053 if(sscanf(params, "ui", id, skin)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setskin [playerid] [skin(0-311)]");
2054 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2055 if(skin < 0 || skin == 74 || skin > 311) return SendClientMessage(playerid, COLOR_RED, "* Invalid skinID.");
2056
2057 format(string, 128, "You have set Player "orange"%s "white"skinID to "grey"%d", pName(id), skin);
2058 SendClientMessage(playerid, -1, string);
2059
2060 format(string, 128, "Administrator "orange"%s "white"has set your skinID to "grey"%d", pName(playerid), skin);
2061 SendClientMessage(id, -1, string);
2062
2063 SetPlayerSkin(id, skin);
2064 return 1;
2065}
2066
2067CMD:clearchat(playerid, params[])
2068{
2069 LoginCheck(playerid);
2070 LevelCheck(playerid, 2);
2071
2072 new
2073 string[128]
2074 ;
2075
2076 for(new i=0; i<100; i++)
2077 {
2078 SendClientMessageToAll(-1, " ");
2079 }
2080
2081 format(string, sizeof string, "Administrator "orange"%s "white"has cleared the chat.", pName(playerid));
2082 SendClientMessageToAll(-1, string);
2083 return 1;
2084}
2085
2086CMD:heal(playerid, params[])
2087{
2088 LoginCheck(playerid);
2089 LevelCheck(playerid, 2);
2090
2091 new
2092 id,
2093 string[130]
2094 ;
2095
2096 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /heal [playerid]");
2097 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2098
2099 SetPlayerHealth(id, 100.0);
2100 format(string, sizeof(string), "You have given Player %s a full pack of health.", pName(id));
2101 SendClientMessage(playerid, COLOR_YELLOW, string);
2102 format(string, sizeof(string), "Administrator %s has given you a full pack of health.", pName(playerid));
2103 SendClientMessage(id, COLOR_YELLOW, string);
2104 return 1;
2105}
2106
2107CMD:armour(playerid, params[])
2108{
2109 LoginCheck(playerid);
2110 LevelCheck(playerid, 2);
2111
2112 new
2113 id,
2114 string[130]
2115 ;
2116
2117 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /armour [playerid]");
2118 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2119
2120 SetPlayerArmour(id, 100.0);
2121 format(string, sizeof(string), "You have given %s an armour.", pName(id));
2122 SendClientMessage(playerid, COLOR_YELLOW, string);
2123 format(string, sizeof(string), "Administrator %s has given you a full armour.", pName(playerid));
2124 SendClientMessage(id, COLOR_YELLOW, string);
2125 return 1;
2126}
2127
2128CMD:setinterior(playerid, params[])
2129{
2130 LoginCheck(playerid);
2131 LevelCheck(playerid, 2);
2132
2133 new
2134 string[130],
2135 id,
2136 interior
2137 ;
2138
2139 if(sscanf(params, "ui", id, interior)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setinterior [playerid] [interior]");
2140 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2141 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2142 SetPlayerInterior(id, interior);
2143 format(string, sizeof(string), "Administrator %s has set your interior to %d.", pName(playerid), interior);
2144 SendClientMessage(id, COLOR_ORANGE, string);
2145 format(string, sizeof(string), "You have set Player %s's interior to %d.", pName(id), interior);
2146 SendClientMessage(playerid, COLOR_ORANGE, string);
2147 return 1;
2148}
2149
2150CMD:setworld(playerid, params[])
2151{
2152 LoginCheck(playerid);
2153 LevelCheck(playerid, 2);
2154
2155 new
2156 string[130],
2157 id,
2158 vw
2159 ;
2160
2161 if(sscanf(params, "ui", id, vw)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setworld [playerid] [virtual world]");
2162 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2163 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2164 SetPlayerVirtualWorld(id, vw);
2165 format(string, sizeof(string), "Administrator %s has set your virtual world to %d.", pName(playerid), vw);
2166 SendClientMessage(id, COLOR_ORANGE, string);
2167 format(string, sizeof(string), "You have set Player %s's virtual world to %d.", pName(id), vw);
2168 SendClientMessage(playerid, COLOR_ORANGE, string);
2169 return 1;
2170}
2171
2172CMD:explode(playerid, params[])
2173{
2174 LoginCheck(playerid);
2175 LevelCheck(playerid, 2);
2176
2177 new string[128],
2178 id,
2179 Float:x,
2180 Float:y,
2181 Float:z,
2182 reason[128]
2183 ;
2184
2185 if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [playerid] [reason(Default: N/A)]");
2186 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2187 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2188
2189 GetPlayerPos(id, x, y, z);
2190 format(string, sizeof(string), "** %s(%d) has been exploded by Administrator %s [Reason: %s]", pName(id), id, pName(playerid), reason);
2191 SendClientMessageToAll(COLOR_GREY, string);
2192
2193 SaveLog("explode.txt", string);
2194
2195 CreateExplosion(x, y, z, 7, 1.00);
2196 return 1;
2197}
2198
2199CMD:disarm(playerid, params[])
2200{
2201 LoginCheck(playerid);
2202 LevelCheck(playerid, 2);
2203
2204 new
2205 string[130],
2206 id
2207 ;
2208
2209 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /disarm [playerid]");
2210 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2211 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2212 ResetPlayerWeapons(id);
2213 format(string, sizeof(string), "You have removed Player %s's guns.", pName(id));
2214 SendClientMessage(playerid, COLOR_YELLOW, string);
2215 format(string, sizeof(string), "Administrator %s has removed your guns.", pName(playerid));
2216 SendClientMessage(id, COLOR_YELLOW, string);
2217 return 1;
2218}
2219
2220//============================================================================//
2221// Administrative Level Three //
2222//============================================================================//
2223
2224CMD:forbidword(playerid, params[])
2225{
2226 LoginCheck(playerid);
2227 LevelCheck(playerid, 3);
2228
2229 new string[128], File:BLfile;
2230
2231 if(isnull(params))
2232 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidword [word]");
2233
2234 BLfile = fopen("JakAdmin3/ForbiddenWords.cfg", io_append);
2235 format(string, sizeof(string), "%s\r\n", params);
2236 fwrite(BLfile, string);
2237 fclose(BLfile);
2238
2239 format(string, sizeof(string), "Admin %s has added the word \"%s\" to the forbidden word list", pName(playerid), params);
2240 SendAdmin(COLOR_GREEN, string);
2241
2242 UpdateForbidden();
2243 return 1;
2244}
2245
2246CMD:forbidname(playerid, params[])
2247{
2248 LoginCheck(playerid);
2249 LevelCheck(playerid, 3);
2250
2251 new string[128], File:BLfile;
2252
2253 if(isnull(params))
2254 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidname [nickname]");
2255
2256 if(strlen(params) < 3 || strlen(params) > 20)
2257 return SendClientMessage(playerid, COLOR_RED, "USAGE: /forbidname [nickname]");
2258
2259 BLfile = fopen("JakAdmin3/ForbiddenNames.cfg", io_append);
2260 format(string, sizeof(string), "%s\r\n", params);
2261 fwrite(BLfile, string);
2262 fclose(BLfile);
2263
2264 format(string, sizeof(string), "Admin %s has added the name \"%s\" to the forbidden name list", pName(playerid), params);
2265 SendAdmin(COLOR_GREEN, string);
2266
2267 UpdateForbidden();
2268 return 1;
2269}
2270
2271CMD:jsettings(playerid, params[])
2272{
2273 LoginCheck(playerid);
2274 LevelCheck(playerid, 3);
2275
2276 ShowSettings(playerid);
2277 return 1;
2278}
2279
2280CMD:get(playerid, params[])
2281{
2282 LoginCheck(playerid);
2283 LevelCheck(playerid, 3);
2284
2285 new
2286 id,
2287 string[130],
2288 Float:x,
2289 Float:y,
2290 Float:z
2291 ;
2292 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /get [playerid]");
2293
2294 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2295 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot teleport yourself to yourself.");
2296 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2297
2298 GetPlayerPos(playerid, x, y, z);
2299 SetPlayerInterior(id, GetPlayerInterior(playerid));
2300 SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
2301
2302 if(GetPlayerState(id) == 2)
2303 {
2304 new VehicleID = GetPlayerVehicleID(id);
2305 SetVehiclePos(VehicleID, x+3, y, z);
2306 LinkVehicleToInterior(VehicleID, GetPlayerInterior(playerid));
2307 SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(playerid));
2308 }
2309 else SetPlayerPos(id, x+2, y, z);
2310
2311 format(string, sizeof(string), "You have been teleported to Admin %s(ID:%d) location.", pName(playerid), playerid);
2312 SendClientMessage(id, COLOR_YELLOW, string);
2313 format(string, sizeof(string), "You have teleported %s(ID:%d) to your location.", pName(id), id);
2314 SendClientMessage(playerid, COLOR_YELLOW, string);
2315 return 1;
2316}
2317
2318CMD:crash(playerid, params[])
2319{
2320 LoginCheck(playerid);
2321 LevelCheck(playerid, 3);
2322
2323 new id, string[128];
2324
2325 if(sscanf(params, "u", id))
2326 return SendClientMessage(playerid, COLOR_RED, "USAGE: /crash [playerid]");
2327
2328 if(id == INVALID_PLAYER_ID)
2329 return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2330
2331 if(User[playerid][accountAdmin] < User[id][accountAdmin] && id != playerid)
2332 return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2333
2334 format(string, sizeof(string), "You crashed Player %s (ID: %d).", pName(id), id);
2335 SendClientMessage(playerid, -1, string);
2336 format(string, sizeof(string), "Admin %s has crashed your game.", pName(playerid));
2337 SendClientMessage(id, COLOR_YELLOW, string);
2338
2339 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
2340 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
2341 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
2342 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
2343 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
2344 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
2345 GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
2346 return 1;
2347}
2348
2349CMD:write(playerid, params[])
2350{
2351 LoginCheck(playerid);
2352 LevelCheck(playerid, 3);
2353
2354 new
2355 Colour,
2356 string[130]
2357 ;
2358 if(sscanf(params, "is[128]", Colour, params))
2359 return SendClientMessage(playerid, COLOR_RED, "USAGE: /write [color] [text]") &&
2360 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");
2361 if(Colour > 9) return 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");
2362
2363 if(Colour == 0) { format(string,sizeof(string),"%s",params); SendClientMessageToAll(COLOR_BLACK,string);return 1;}
2364 else if(Colour == 1) {
2365 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_WHITE,string); return 1;}
2366 else if(Colour == 2) {
2367 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_RED,string); return 1;}
2368 else if(Colour == 3) {
2369 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_ORANGE,string); return 1;}
2370 else if(Colour == 4) {
2371 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_YELLOW,string); return 1;}
2372 else if(Colour == 5) {
2373 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_GREEN,string); return 1;}
2374 else if(Colour == 6) {
2375 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_BLUE,string); return 1;}
2376 else if(Colour == 7) {
2377 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_PURPLE,string); return 1;}
2378 else if(Colour == 8) {
2379 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_BROWN,string); return 1;}
2380 else if(Colour == 9) {
2381 format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_PINK,string); return 1;}
2382 return 1;
2383}
2384
2385CMD:force(playerid, params[])
2386{
2387 LoginCheck(playerid);
2388 LevelCheck(playerid, 3);
2389
2390 new
2391 string[130],
2392 id
2393 ;
2394
2395 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /force [playerid]");
2396 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2397 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2398
2399 format(string, sizeof(string), "You have forced Player %s(ID:%d) to goto class selection.", pName(id), id);
2400 SendClientMessage(playerid, COLOR_YELLOW, string);
2401
2402 format(string, sizeof(string), "Admin %s(ID:%d) forced you to goto class selection.", pName(playerid), playerid);
2403 SendClientMessage(id, COLOR_YELLOW, string);
2404
2405 SetPlayerHealth(id, 0.0);
2406 ForceClassSelection(id);
2407 return 1;
2408}
2409
2410CMD:healall(playerid, params[])
2411{
2412 LoginCheck(playerid);
2413 LevelCheck(playerid, 3);
2414
2415 new
2416 string[130]
2417 ;
2418
2419 foreach(new i : Player)
2420 {
2421 if(i != playerid)
2422 {
2423 SetPlayerHealth(i, 100.0);
2424 }
2425 }
2426 format(string, sizeof(string), "Admin %s(ID:%d) has heal all players.", pName(playerid), playerid);
2427 SendClientMessageToAll(COLOR_YELLOW, string);
2428 return 1;
2429}
2430
2431CMD:setfstyle(playerid, params[])
2432{
2433 LoginCheck(playerid);
2434 LevelCheck(playerid, 3);
2435
2436 new
2437 string[128],
2438 id,
2439 fstyle,
2440 style[50]
2441 ;
2442
2443 if(sscanf(params, "ui", id, fstyle)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setfstyle [playerid] [styles]") &&
2444 SendClientMessage(playerid, COLOR_GREY, "Styles: [0]Normal, [1]Boxing, [2]Kungfu, [3]Kneehead, [4]Grabkick, [5]Elbow");
2445 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2446 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2447 if(fstyle > 5) return SendClientMessage(playerid, COLOR_RED, "* Inavlid Fighting Style.");
2448
2449 switch(fstyle)
2450 {
2451 case 0:
2452 {
2453 SetPlayerFightingStyle(id, 4);
2454 style = "Normal";
2455 }
2456 case 1:
2457 {
2458 SetPlayerFightingStyle(id, 5);
2459 style = "Boxing";
2460 }
2461 case 2:
2462 {
2463 SetPlayerFightingStyle(id, 6);
2464 style = "Kung Fu";
2465 }
2466 case 3:
2467 {
2468 SetPlayerFightingStyle(id, 7);
2469 style = "Kneehead";
2470 }
2471 case 4:
2472 {
2473 SetPlayerFightingStyle(id, 15);
2474 style = "Grabkick";
2475 }
2476 case 5:
2477 {
2478 SetPlayerFightingStyle(id, 16);
2479 style = "Elbow";
2480 }
2481 }
2482 format(string, sizeof(string), "You have set %s(ID:%d) fighting style to '%s'", pName(id), id, style);
2483 SendClientMessage(playerid, COLOR_YELLOW, string);
2484 format(string, sizeof(string), "Admin %s(ID:%d) has set your fighting style to '%s'", pName(playerid), playerid, style);
2485 SendClientMessage(id, COLOR_YELLOW, string);
2486 return 1;
2487}
2488
2489CMD:sethealth(playerid, params[])
2490{
2491 LoginCheck(playerid);
2492 LevelCheck(playerid, 3);
2493
2494 new
2495 string[130],
2496 id,
2497 hp
2498 ;
2499
2500 if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /sethealth [playerid] [heatlh]");
2501 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2502 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2503
2504 new Float:hp2 = float(hp);
2505
2506 SetPlayerHealth(id, hp2);
2507
2508 format(string, sizeof(string), "You have set Player %s(ID:%d) health to %d", pName(id), id, floatround(hp2));
2509 SendClientMessage(playerid, COLOR_YELLOW, string);
2510 format(string, sizeof(string), "Admin %s(ID:%d) has set your health to %d", pName(playerid), playerid, floatround(hp2));
2511 SendClientMessage(id, COLOR_YELLOW, string);
2512 return 1;
2513}
2514
2515CMD:setarmour(playerid, params[])
2516{
2517 LoginCheck(playerid);
2518 LevelCheck(playerid, 3);
2519
2520 new
2521 string[130],
2522 id,
2523 armour
2524 ;
2525
2526 if(sscanf(params, "ud", id, armour)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setarmour [playerid] [armour]");
2527 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2528 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2529
2530 new Float:ar = float(armour);
2531 SetPlayerArmour(id, ar);
2532
2533 format(string, sizeof(string), "You have set Player %s(ID:%d) armour to %d", pName(id), id, floatround(ar));
2534 SendClientMessage(playerid, COLOR_YELLOW, string);
2535 format(string, sizeof(string), "Admin %s(ID:%d) has set your armour to %d", pName(playerid), playerid, floatround(ar));
2536 SendClientMessage(id, COLOR_YELLOW, string);
2537 return 1;
2538}
2539
2540CMD:destroycar(playerid, params[])
2541{
2542 LoginCheck(playerid);
2543 LevelCheck(playerid, 3);
2544 DelVehicle(GetPlayerVehicleID(playerid));
2545 return 1;
2546}
2547
2548CMD:teleplayer(playerid, params[])
2549{
2550 LoginCheck(playerid);
2551 LevelCheck(playerid, 3);
2552
2553 new
2554 string[128],
2555 id,
2556 id2,
2557 Float:x,
2558 Float:y,
2559 Float:z
2560 ;
2561 if(sscanf(params, "uu", id, id2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /teleplayer [playerid] to [playerid2]");
2562 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2563 if(User[playerid][accountAdmin] < User[id2][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2564 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2565 if(id2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2566 if(id == playerid && id2 == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot teleport yourself to yourself!");
2567 GetPlayerPos(id2, x, y, z);
2568 format(string, sizeof(string), "You have teleported Player %s(%d) to Player %s(%d)", pName(id), id, pName(id2), id2);
2569 SendClientMessage(playerid, COLOR_YELLOW, string);
2570 format(string, sizeof(string), "You have been teleported to Player %s(%d) by Admin %s(%d)", pName(id2), id2, pName(playerid), playerid);
2571 SendClientMessage(id, COLOR_YELLOW, string);
2572 format(string, sizeof(string), "Admin %s(%d) has port %s(%d) to you", pName(playerid), playerid, pName(id), id);
2573 SendClientMessage(id2, COLOR_YELLOW, string);
2574 SetPlayerInterior(id, GetPlayerInterior(id2));
2575 SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(id2));
2576 if(GetPlayerState(id) == 2)
2577 {
2578 SetVehiclePos(GetPlayerVehicleID(id), x+3, y, z);
2579 LinkVehicleToInterior(GetPlayerVehicleID(id), GetPlayerInterior(id2));
2580 SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(id2));
2581 }
2582 else SetPlayerPos(id, x+2, y, z);
2583 return 1;
2584}
2585
2586CMD:god(playerid, params[])
2587{
2588 LoginCheck(playerid);
2589 LevelCheck(playerid, 3);
2590
2591 if(_God[playerid] == 0)
2592 {
2593 //Removal of the weapons has been made.
2594 SendClientMessage(playerid, COLOR_GREEN, "God Mode On!");
2595 _God[playerid] = 1;
2596 }
2597 else if(_God[playerid] == 1)
2598 {
2599 _God[playerid] = 0;
2600 SendClientMessage(playerid, COLOR_RED, "God Mode Off!");
2601 SetPlayerHealth(playerid, 100.0);
2602 }
2603 return 1;
2604}
2605
2606CMD:armourall(playerid, params[])
2607{
2608 LoginCheck(playerid);
2609 LevelCheck(playerid, 3);
2610
2611 new
2612 string[130]
2613 ;
2614 foreach(new i : Player)
2615 {
2616 if(i != playerid)
2617 {
2618 SetPlayerArmour(i, 100.0);
2619 }
2620 }
2621 format(string, sizeof(string), "Admin %s(ID:%d) has given everyone an armour.", pName(playerid), playerid);
2622 SendClientMessageToAll(COLOR_YELLOW, string);
2623 return 1;
2624}
2625
2626CMD:bankrupt(playerid, params[])
2627{
2628 LoginCheck(playerid);
2629 LevelCheck(playerid, 3);
2630
2631 new
2632 id,
2633 string[130]
2634 ;
2635
2636 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /bankrupt [playerid]");
2637 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2638 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2639
2640 ResetPlayerMoney(id);
2641
2642 format(string, sizeof(string), "Admin %s(ID:%d) has taken all your cash in-hand.", pName(playerid), playerid);
2643 SendClientMessage(id, COLOR_YELLOW, string);
2644 format(string, sizeof(string), "You have taken all the money in hand of Player %s(%d).", pName(id), id);
2645 SendClientMessage(playerid, COLOR_YELLOW, string);
2646 return 1;
2647}
2648
2649CMD:getall(playerid, params[])
2650{
2651 LoginCheck(playerid);
2652 LevelCheck(playerid, 3);
2653
2654 new Float:x,
2655 Float:y,
2656 Float:z,
2657 string[130],
2658 interior = GetPlayerInterior(playerid)
2659 ;
2660
2661 GetPlayerPos(playerid, x, y, z);
2662 foreach(new i : Player)
2663 {
2664 if(i != playerid)
2665 {
2666 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
2667 SetPlayerPos(i, x+(playerid/4)+1, y+(playerid/4), z);
2668 SetPlayerInterior(i, interior);
2669 SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
2670 }
2671 }
2672
2673 format(string, sizeof(string), "Admin %s(ID:%d) has teleported all players to his or HER position!", pName(playerid), playerid);
2674 SendClientMessageToAll(COLOR_YELLOW, string);
2675 return 1;
2676}
2677
2678CMD:freeze(playerid, params[])
2679{
2680 LoginCheck(playerid);
2681 LevelCheck(playerid, 3);
2682
2683 new
2684 string[130],
2685 id,
2686 reason[128]
2687 ;
2688 if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /freeze [playerid] [reason]");
2689 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2690 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot freeze yourself.");
2691 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2692
2693 TogglePlayerControllable(id, false);
2694
2695 format(string, sizeof(string), "You have frozen Player %s(%d) (Reason: %s)", pName(id), id, reason);
2696 SendClientMessage(playerid, COLOR_YELLOW, string);
2697 format(string, sizeof(string), "Administrator %s(ID:%d) has frozen you (Reason: %s)", pName(playerid), playerid, reason);
2698 SendClientMessage(id, COLOR_YELLOW, string);
2699 return 1;
2700}
2701
2702CMD:unfreeze(playerid, params[])
2703{
2704 LoginCheck(playerid);
2705 LevelCheck(playerid, 3);
2706
2707 new
2708 string[128],
2709 id
2710 ;
2711
2712 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unfreeze [playerid]");
2713 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2714 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot unfreeze yourself.");
2715 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2716
2717 TogglePlayerControllable(id, true);
2718
2719 format(string, sizeof(string), "You have unfrozen Player %s(%d)", pName(id), id);
2720 SendClientMessage(playerid, COLOR_YELLOW, string);
2721 format(string, sizeof(string), "Admin %s(%d) has unfrozen you.", pName(playerid), playerid);
2722 SendClientMessage(id, COLOR_YELLOW, string);
2723 return 1;
2724}
2725
2726CMD:giveweapon(playerid, params[])
2727{
2728 LoginCheck(playerid);
2729 LevelCheck(playerid, 3);
2730
2731 new
2732 id,
2733 ammo,
2734 wID[32],
2735 weap,
2736 WeapName[32],
2737 string[130]
2738 ;
2739
2740 if(sscanf(params, "us[32]i", id, wID, ammo)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveweapon [playerid] [weaponid(or weapon name)] [ammo]");
2741 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2742 if(ammo <= 0 || ammo > 99999) ammo = 500;
2743 if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
2744 else weap = strval(wID);
2745 if(!IsValidWeapon(weap)) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID.");
2746 GetWeaponName(weap, WeapName, 32);
2747
2748 format(string, sizeof(string), "You gave a %s(%d) with %d rounds of ammunation to %s.", WeapName, weap, ammo, pName(id));
2749 SendClientMessage(playerid, COLOR_YELLOW, string);
2750 format(string,sizeof(string),"Administrator %s has given you a %s(%d) with %d rounds of ammunation.", pName(playerid), WeapName, weap, ammo);
2751 SendClientMessage(id, COLOR_YELLOW, string);
2752 GivePlayerWeapon(id, weap, ammo);
2753 return 1;
2754}
2755
2756CMD:unban(playerid, params[])
2757{
2758 LoginCheck(playerid);
2759 LevelCheck(playerid, 3);
2760
2761 new
2762 string[150],
2763 Account[24],
2764 DBResult:Result,
2765 Query[129],
2766 fIP[30]
2767 ;
2768 if(sscanf(params, "s[24]", Account)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unban [account name]");
2769 format(Query, 129, "SELECT * FROM `bans` WHERE `username` = '%s'", Account);
2770 Result = db_query(Database, Query);
2771
2772 if(db_num_rows(Result))
2773 {
2774 db_get_field_assoc(Result, "ip", fIP, 30);
2775 RemoveBan(fIP);
2776
2777 format(Query, 129, "DELETE FROM `bans` WHERE `username` = '%s'", DB_Escape(Account));
2778 Result = db_query(Database, Query);
2779 db_free_result(Result);
2780
2781 format(string, sizeof string, "Administrator %s has unbanned %s.", pName(playerid), Account);
2782 SendClientMessageToAll(COLOR_YELLOW, string);
2783 print(string);
2784
2785 SaveLog("banlog.txt", string);
2786 }
2787 else
2788 {
2789 db_free_result(Result);
2790 SendClientMessage(playerid, COLOR_RED, "* Player is not in the banned database.");
2791 return 1;
2792 }
2793 return 1;
2794}
2795
2796CMD:ban(playerid, params[])
2797{
2798 LoginCheck(playerid);
2799 LevelCheck(playerid, 3);
2800
2801 new
2802 string[128],
2803 id,
2804 reason[128],
2805 when[128],
2806 ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years
2807 ;
2808
2809 gettime(ban_hr, ban_min, ban_sec);
2810 getdate(ban_years, ban_month, ban_days);
2811
2812 if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban [playerid] [reason(Default: No Reason)]");
2813 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2814 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command to yourself.");
2815 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2816
2817 format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
2818
2819 format(string, sizeof(string), "** %s(ID:%d) has been banned by Administrator %s(%d) (Reason: %s)", pName(id), id, pName(playerid), playerid, reason);
2820 SendClientMessageToAll(COLOR_GREY, string);
2821 printf(string);
2822
2823 SaveLog("banlog.txt", string);
2824
2825 format(string, sizeof(string), "You have banned %s(%d) for %s.", pName(id), id, reason);
2826 SendClientMessage(playerid, COLOR_YELLOW, string);
2827 format(string, sizeof(string), "You have been banned by Administrator %s(%d) (Reason: %s)", pName(playerid), playerid, reason);
2828 SendClientMessage(id, COLOR_YELLOW, string);
2829 BanAccount(id, pName(playerid), reason);
2830 ShowBan(id, GetPVarInt(id, "ban_id"), pName(playerid), reason, when);
2831 KickDelay(id);
2832 return 1;
2833}
2834
2835CMD:oban(playerid, params[])
2836{
2837 LoginCheck(playerid);
2838 LevelCheck(playerid, 3);
2839
2840 new
2841 string[150],
2842 name[24],
2843 reason[128],
2844 Query[256],
2845 admin,
2846 ip[20],
2847 DBResult:Result,
2848 ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years
2849 ;
2850
2851 gettime(ban_hr, ban_min, ban_sec);
2852 getdate(ban_years, ban_month, ban_days);
2853
2854 if(sscanf(params, "s[24]s[128]", name, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /oban [name in the data] [reason]");
2855 foreach(new i : Player)
2856 {
2857 if(strcmp(pName(i), name, true) == 0)
2858 {
2859 SendClientMessage(playerid, COLOR_RED, "* Player that you are trying to banned is online, /ban instead.");
2860 return 1;
2861 }
2862 }
2863 format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
2864 Result = db_query(Database, Query);
2865 if(db_num_rows(Result))
2866 {
2867 db_get_field_assoc(Result, "admin", Query, 6);
2868 admin = strval(Query);
2869 db_get_field_assoc(Result, "IP", ip, 20);
2870
2871 if(User[playerid][accountAdmin] < admin)
2872 {
2873 SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on high ranking admin.");
2874
2875 format(string, sizeof(string), "%s has attempted to offline banned %s but failed for %s", pName(playerid), name, reason);
2876 SaveLog("admin.txt", string);
2877 return 1;
2878 }
2879
2880 BanAccountEx(name, ip, pName(playerid), reason);
2881
2882 format(string, sizeof(string), "** %s has been offine banned by Administrator %s(%d) (Reason: %s)", name, pName(playerid), playerid, reason);
2883 SendClientMessageToAll(COLOR_GREY, string);
2884 printf(string);
2885 SaveLog("banlog.txt", string);
2886 }
2887 else
2888 {
2889 SendClientMessage(playerid, COLOR_RED, "* There is no such thing players in the server database.");
2890 }
2891 db_free_result(Result);
2892 return 1;
2893}
2894
2895CMD:cname(playerid, params[])
2896{
2897 LoginCheck(playerid);
2898 LevelCheck(playerid, 3);
2899
2900 new
2901 string[128],
2902 id,
2903 result = 0,
2904 newname[24]
2905 ;
2906
2907 if(sscanf(params, "us[24]", id, newname)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /cname [playerid] [new name]");
2908 if(strlen(newname) < 3 || strlen(newname) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED, "* Invalid Name Length.");
2909 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2910 if((result = CheckAccount(newname)) != 0)
2911 {
2912 format(string, sizeof(string), "* This name is already taken (#UserID %d)", result);
2913 SendClientMessage(playerid, COLOR_RED, string);
2914 return 1;
2915 }
2916 if(!User[id][accountLogged]) return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
2917 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2918
2919 format(string, sizeof string, "Administrator %s has set %s's name to %s", pName(playerid), pName(id), newname);
2920 SaveLog("account.txt", string);
2921
2922 format(string, sizeof(string), "You have set \"%s's\" name to \"%s\".", pName(id), newname); SendClientMessage(playerid, COLOR_YELLOW, string);
2923 format(string, sizeof(string), "Administrator \"%s\" has set your name to \"%s\".", pName(playerid), newname); SendClientMessage(id, COLOR_YELLOW, string);
2924 SetPlayerName(id, newname);
2925
2926 SendClientMessage(id, -1, "You have been logged out from your current account, Reconnecting to the server...");
2927
2928 format(string, sizeof(string), "UPDATE `users` SET `username` = '%s' WHERE `userid` = %d", DB_Escape(newname), User[id][accountID]);
2929 db_query(Database, string);
2930 return 1;
2931}
2932
2933CMD:slap(playerid, params[])
2934{
2935 LoginCheck(playerid);
2936 LevelCheck(playerid, 3);
2937
2938 new
2939 Float:x,
2940 Float:y,
2941 Float:z,
2942 Float:health,
2943 string[128],
2944 id,
2945 reason[128]
2946 ;
2947
2948 if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /slap [playerid] [reason(Default: N/A)]");
2949 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2950 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2951 GetPlayerPos(id, x, y, z);
2952 GetPlayerHealth(id, health);
2953 SetPlayerHealth(id, health-25);
2954 SetPlayerPos(id, x, y, z+5);
2955 PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
2956 PlayerPlaySound(id, 1190, 0.0, 0.0, 0.0);
2957 format(string, sizeof(string), "** %s(%d) has been slapped by Administrator %s [Reason: %s]", pName(id), id, pName(playerid), reason);
2958 SendClientMessageToAll(COLOR_GREY, string);
2959 return 1;
2960}
2961
2962CMD:setcolor(playerid, params[])
2963{
2964 LoginCheck(playerid);
2965 LevelCheck(playerid, 3);
2966
2967 new id;
2968 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcolor [playerid]");
2969 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2970 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2971
2972 SetPVarInt(playerid, "_Colors_", id);
2973
2974 ShowPlayerDialog(playerid, DIALOG_COLORS, DIALOG_STYLE_LIST, ""orange"Colors", ""black"Black\n"white"White\n"red"Red\n"orange"Orange\n"yellow"Yellow\n"green"Green\n"blue"Blue\n"purple"Purple\n"brown"Brown\n"pink"Pink", "Set", "Cancel");
2975 return 1;
2976}
2977
2978CMD:setmoney(playerid, params[])
2979{
2980 LoginCheck(playerid);
2981 LevelCheck(playerid, 3);
2982
2983 new
2984 id,
2985 string[128],
2986 amount
2987 ;
2988
2989 if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setmoney [playerid] [cash]");
2990 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
2991 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
2992
2993 ResetPlayerMoney(id);
2994 GivePlayerMoney(id, amount);
2995 format(string, sizeof(string), "You have set %s's cash to $%i.", pName(id), amount);
2996 SendClientMessage(playerid, COLOR_YELLOW, string);
2997 format(string, sizeof(string), "Administrator %s has set your cash to $%i.", pName(playerid), amount);
2998 SendClientMessage(id, COLOR_YELLOW, string);
2999
3000 format(string, sizeof string, "Administrator %s has set %s's cash to $%i", pName(playerid), pName(id), amount);
3001 SaveLog("set.txt", string);
3002 return 1;
3003}
3004
3005CMD:setscore(playerid, params[])
3006{
3007 LoginCheck(playerid);
3008 LevelCheck(playerid, 3);
3009
3010 new
3011 id,
3012 string[128],
3013 amount
3014 ;
3015
3016 if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setscore [playerid] [score]");
3017 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3018 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3019
3020 SetPlayerScore(id, amount);
3021 format(string, sizeof(string), "You have set %s's score to %i.", pName(id), amount);
3022 SendClientMessage(playerid, COLOR_YELLOW, string);
3023 format(string, sizeof(string), "Administrator %s has set your score to %i.", pName(playerid), amount);
3024 SendClientMessage(id, COLOR_YELLOW, string);
3025
3026 format(string, sizeof string, "Administrator %s has set %s's score to %i", pName(playerid), pName(id), amount);
3027 SaveLog("set.txt", string);
3028 return 1;
3029}
3030
3031//============================================================================//
3032// Administrative Level Four //
3033//============================================================================//
3034
3035CMD:gmx(playerid, params[])
3036{
3037 new
3038 string[128],
3039 time
3040 ;
3041
3042 LoginCheck(playerid);
3043 LevelCheck(playerid, 4);
3044
3045 if(sscanf(params, "I(0)", time)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gmx [Restart Timer(optional)") &&
3046 SendClientMessage(playerid, -1, "Note: You can leave the parameter for a fast restart, no timers.");
3047
3048 if(time < 10 && time !=0) return SendClientMessage(playerid, COLOR_RED, "* Restart Time shouldn't go below ten.");
3049
3050 if(time >= 10)
3051 {
3052 format(string, sizeof(string), "Admin %s(ID:%d) has announced a server restart which will end in %d seconds.", pName(playerid), playerid, time);
3053 SendClientMessageToAll(COLOR_YELLOW, string);
3054
3055 SetTimer("RestartTimer", 1000*time, false);
3056 }
3057 else
3058 {
3059 format(string, sizeof(string), "Admin %s(ID:%d) has restarted the server.", pName(playerid), playerid);
3060 SendClientMessageToAll(COLOR_YELLOW, string);
3061
3062 SendRconCommand("gmx");
3063 }
3064 return 1;
3065}
3066
3067function:RestartTimer()
3068{
3069 SendClientMessageToAll(COLOR_YELLOW, "Restart Time has been reached, Restarting the server now.");
3070 return SendRconCommand("gmx");
3071}
3072
3073CMD:fakedeath(playerid, params[])
3074{
3075 new
3076 string[128],
3077 id,
3078 killerid,
3079 weapid
3080 ;
3081
3082 LoginCheck(playerid);
3083 LevelCheck(playerid, 4);
3084
3085 if(sscanf(params, "uui", killerid, id, weapid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakedeath [killer] [victim] [weapon]");
3086 if(killerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* KillerID not connected.");
3087 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* VictimID not connected.");
3088 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3089 if(User[playerid][accountAdmin] < User[killerid][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3090 if(id == playerid && killerid == playerid) return SendClientMessage(playerid, COLOR_RED, "* You can't be KillerID and VictimID at the same time.");
3091 if(!IsValidWeapon(weapid)) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID.");
3092
3093 SendDeathMessage(killerid, id, weapid);
3094
3095 format(string, sizeof(string), "Fake Death Sent. [ Victim: %s(%d) | Suspect: %s(%d) | WeaponID: %i ]", pName(id), id, pName(killerid), killerid, weapid);
3096 SendClientMessage(playerid, COLOR_YELLOW, string);
3097 return 1;
3098}
3099
3100CMD:setallskin(playerid, params[])
3101{
3102 new string[128+40], skin;
3103
3104 LoginCheck(playerid);
3105 LevelCheck(playerid, 4);
3106
3107 if(sscanf(params, "i", skin)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallskin [skin(0-311)]");
3108 if(skin < 0 || skin == 74 || skin > 311) return SendClientMessage(playerid, COLOR_RED, "* Invalid skinID.");
3109
3110 foreach(new i : Player)
3111 {
3112 SetPlayerSkin(i, skin);
3113 }
3114
3115 format(string, sizeof(string), "Admin %s(ID:%d) has set everyones skin to %d.", pName(playerid), playerid, skin);
3116 SendClientMessageToAll(COLOR_YELLOW, string);
3117 return 1;
3118}
3119
3120CMD:cmdmuted(playerid, params[])
3121{
3122 new string[128], count = 0;
3123
3124 SendClientMessage(playerid, -1, "** "orange"Command Muted Players "white"**");
3125 foreach(new i : Player)
3126 {
3127 if(User[i][accountLogged] == 1)
3128 {
3129 if(User[i][accountCMuted] == 1)
3130 {
3131 format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountCMuteSec]);
3132 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
3133 count++;
3134 }
3135 }
3136 }
3137 if(count == 0) return SendClientMessage(playerid, -1, "No command muted players at the server.");
3138 return 1;
3139}
3140
3141CMD:mutecmd(playerid, params[])
3142{
3143 LoginCheck(playerid);
3144 LevelCheck(playerid, 4);
3145
3146 new id, sec, reason[128], string[250];
3147 if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /mutecmd [playerid] [seconds] [reason]");
3148 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3149 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3150 if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "* You cannot mute lower than 30 seconds.");
3151 if(User[id][accountCMuted] == 1) return SendClientMessage(playerid, COLOR_RED, "* Player already muted from using the commands.");
3152 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3153
3154 format(string, sizeof(string), "** %s(%d) has been muted from using commands by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
3155 SendClientMessageToAll(COLOR_GREY, string);
3156 SendClientMessage(id, COLOR_ORANGE, "You have been muted from using commands by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
3157
3158 format(string, sizeof(string), "%s has been muted from using commands by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
3159 SaveLog("mute.txt", string);
3160
3161 User[id][accountCMuted] = 1, User[id][accountCMuteSec] = sec;
3162 return 1;
3163}
3164
3165CMD:unmutecmd(playerid, params[])
3166{
3167 LoginCheck(playerid);
3168 LevelCheck(playerid, 4);
3169
3170 new id, reason[128], string[250];
3171 if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unmutecmd [playerid] [reason]");
3172 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3173 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3174 if(User[id][accountCMuted] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not muted from using the commands.");
3175 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on yourself.");
3176
3177 format(string, sizeof(string), "* %s(%d) has been unmuted from using commands by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
3178 SendClientMessageToAll(COLOR_GREY, string);
3179 SendClientMessage(id, COLOR_ORANGE, "You have been unmuted from using commands by an Admin.");
3180
3181 format(string, sizeof(string), "%s has been unmuted from using commands by %s", pName(id), pName(playerid));
3182 SaveLog("mute.txt", string);
3183
3184 User[id][accountCMuted] = 0, User[id][accountCMuteSec] = 0;
3185 return 1;
3186}
3187
3188CMD:setallinterior(playerid, params[])
3189{
3190 LoginCheck(playerid);
3191 LevelCheck(playerid, 4);
3192
3193 new
3194 id,
3195 string[130]
3196 ;
3197 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallinterior [interior]");
3198 foreach(new i : Player)
3199 {
3200 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3201 SetPlayerInterior(i, id);
3202 }
3203 format(string, sizeof(string), "Admin %s(ID:%d) has set all players interior to \"%d\"", pName(playerid), playerid, id);
3204 SendClientMessageToAll(COLOR_YELLOW, string);
3205 return 1;
3206}
3207
3208CMD:explodeall(playerid, params[])
3209{
3210 LoginCheck(playerid);
3211 LevelCheck(playerid, 4);
3212
3213 new
3214 string[130],
3215 Float:x,
3216 Float:y,
3217 Float:z
3218 ;
3219
3220 foreach(new i : Player)
3221 {
3222 if(i != playerid)
3223 {
3224 GetPlayerPos(i, x, y, z);
3225 CreateExplosion(x, y, z, 7, 1.00);
3226 }
3227 }
3228
3229 format(string, sizeof(string), "Admin %s(ID:%d) has exploded all players.", pName(playerid), playerid);
3230 SendClientMessageToAll(COLOR_YELLOW, string);
3231 printf(string);
3232 return 1;
3233}
3234
3235CMD:killall(playerid, params[])
3236{
3237 LoginCheck(playerid);
3238 LevelCheck(playerid, 4);
3239
3240 new
3241 string[130]
3242 ;
3243
3244 foreach(new i : Player)
3245 {
3246 if(i != playerid)
3247 {
3248 if(_God[i] == 1)
3249 {
3250 _God[i] = 0;
3251 }
3252 SetPlayerHealth(i, 0.0);
3253 }
3254 }
3255
3256 format(string, sizeof(string), "Admin %s(ID:%d) has killed all players.", pName(playerid), playerid);
3257 SendClientMessageToAll(COLOR_YELLOW, string);
3258 printf(string);
3259 return 1;
3260}
3261
3262CMD:slapall(playerid, params[])
3263{
3264 LoginCheck(playerid);
3265 LevelCheck(playerid, 4);
3266
3267 new
3268 string[130],
3269 Float:x,
3270 Float:y,
3271 Float:z,
3272 Float:health
3273 ;
3274
3275 foreach(new i : Player)
3276 {
3277 if(i != playerid)
3278 {
3279 GetPlayerPos(i, x, y, z);
3280 GetPlayerHealth(i, health);
3281 SetPlayerHealth(i, health-25);
3282 SetPlayerPos(i, x, y, z+5);
3283 PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
3284 PlayerPlaySound(i, 1190, 0.0, 0.0, 0.0);
3285 }
3286 }
3287
3288 format(string, sizeof(string), "Admin %s(ID:%d) has slapped all players.", pName(playerid), playerid);
3289 SendClientMessageToAll(COLOR_YELLOW, string);
3290 printf(string);
3291 return 1;
3292}
3293
3294CMD:kickall(playerid, params[])
3295{
3296 LoginCheck(playerid);
3297 LevelCheck(playerid, 4);
3298
3299 new
3300 string[130]
3301 ;
3302
3303 foreach(new i : Player)
3304 {
3305 if(i != playerid)
3306 {
3307 KickDelay(i);
3308 }
3309 }
3310
3311 format(string, sizeof(string), "Admin %s(ID:%d) has kicked all players.", pName(playerid), playerid);
3312 SendClientMessageToAll(COLOR_YELLOW, string);
3313 printf(string);
3314
3315 SaveLog("kicklog.txt", string);
3316 return 1;
3317}
3318
3319CMD:ejectall(playerid, params[])
3320{
3321 LoginCheck(playerid);
3322 LevelCheck(playerid, 4);
3323
3324 new
3325 string[128]
3326 ;
3327
3328 foreach(new i : Player)
3329 {
3330 if(IsPlayerInAnyVehicle(i))
3331 {
3332 RemovePlayerFromVehicle(i);
3333 }
3334 }
3335 format(string, sizeof(string), "Admin %s(ID:%d) has eject all players from their vehicle.", pName(playerid), playerid);
3336 SendClientMessageToAll(COLOR_YELLOW, string);
3337 return 1;
3338}
3339
3340CMD:disarmall(playerid, params[])
3341{
3342 LoginCheck(playerid);
3343 LevelCheck(playerid, 4);
3344
3345 new
3346 string[128]
3347 ;
3348
3349 foreach(new i : Player)
3350 {
3351 ResetPlayerWeapons(i);
3352 }
3353 format(string, sizeof(string), "Admin %s(ID:%d) has remove all players weapon.", pName(playerid), playerid);
3354 SendClientMessageToAll(COLOR_YELLOW, string);
3355 return 1;
3356}
3357
3358CMD:setallworld(playerid, params[])
3359{
3360 LoginCheck(playerid);
3361 LevelCheck(playerid, 4);
3362
3363 new
3364 id,
3365 string[130]
3366 ;
3367 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallworld [world]");
3368 foreach(new i : Player)
3369 {
3370 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3371 SetPlayerVirtualWorld(i, id);
3372 }
3373 format(string, sizeof(string), "Admin %s(ID:%d) has set all players virtual world to \"%d\"", pName(playerid), playerid, id);
3374 SendClientMessageToAll(COLOR_YELLOW, string);
3375 return 1;
3376}
3377
3378CMD:giveallscore(playerid, params[])
3379{
3380 LoginCheck(playerid);
3381 LevelCheck(playerid, 4);
3382
3383 new
3384 id,
3385 string[130]
3386 ;
3387 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallscore [score]");
3388 foreach(new i : Player)
3389 {
3390 if(i != playerid)
3391 {
3392 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3393 SetPlayerScore(i, GetPlayerScore(i) + id);
3394 }
3395 }
3396
3397 format(string, sizeof(string), "Admin %s(ID:%d) has given all players score \"%d\"", pName(playerid), playerid, id);
3398 SendClientMessageToAll(COLOR_YELLOW, string);
3399 return 1;
3400}
3401
3402CMD:giveallcash(playerid, params[])
3403{
3404 LoginCheck(playerid);
3405 LevelCheck(playerid, 4);
3406
3407 new
3408 id,
3409 string[130]
3410 ;
3411 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallcash [money]");
3412 foreach(new i : Player)
3413 {
3414 if(i != playerid)
3415 {
3416 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3417 GivePlayerMoney(i, id);
3418 }
3419 }
3420
3421 format(string, sizeof(string), "Admin %s(ID:%d) has given all players cash \"$%d\"", pName(playerid), playerid, id);
3422 SendClientMessageToAll(COLOR_YELLOW, string);
3423 return 1;
3424}
3425
3426CMD:setalltime(playerid, params[])
3427{
3428 LoginCheck(playerid);
3429 LevelCheck(playerid, 4);
3430
3431 new
3432 id,
3433 string[128]
3434 ;
3435
3436 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setalltime [time(0-23)]");
3437 if(id < 0 || id > 23) return SendClientMessage(playerid, COLOR_RED, "* Invalid Time Hour (0-23).");
3438 foreach(new i : Player)
3439 {
3440 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3441 SetPlayerTime(i, id, 0);
3442 }
3443
3444 format(string, sizeof(string), "Admin %s(ID:%d) has set all players time to \"%d:00\"", pName(playerid), playerid, id);
3445 SendClientMessageToAll(COLOR_YELLOW, string);
3446 return 1;
3447}
3448
3449CMD:setallweather(playerid, params[])
3450{
3451 LoginCheck(playerid);
3452 LevelCheck(playerid, 4);
3453
3454 new
3455 id,
3456 string[128]
3457 ;
3458 if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setallweather [weather(0-45)]");
3459 if(id < 0 || id > 45) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weather ID! (0-45)");
3460 foreach(new i : Player)
3461 {
3462 PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
3463 SetPlayerWeather(i, id);
3464 }
3465 format(string, sizeof(string), "Admin %s(ID:%d) has set all players weather to \"%d\"", pName(playerid), playerid, id);
3466 SendClientMessageToAll(COLOR_YELLOW, string);
3467 return 1;
3468}
3469
3470CMD:respawncars(playerid, params[])
3471{
3472 LoginCheck(playerid);
3473 LevelCheck(playerid, 4);
3474
3475 SendClientMessage(playerid, COLOR_GREEN, "You have successfully Respawned all Vehicles!");
3476 GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000, 3);
3477 for(new cars=0; cars<MAX_VEHICLES; cars++)
3478 {
3479 if(!VehicleOccupied(cars))
3480 {
3481 SetVehicleToRespawn(cars);
3482 }
3483 }
3484 return 1;
3485}
3486
3487CMD:cleardwindow(playerid, params[])
3488{
3489 LoginCheck(playerid);
3490 LevelCheck(playerid, 4);
3491
3492 new
3493 string[128]
3494 ;
3495
3496 format(string, sizeof(string), "Administrator "orange"%s "white"has cleared the Death Window!", pName(playerid));
3497 SendClientMessageToAll(-1, string);
3498 for(new i = 0; i < 20; i++) SendDeathMessage(6000, 5005, 255);
3499 return 1;
3500}
3501
3502CMD:saveallstats(playerid, params[])
3503{
3504 LoginCheck(playerid);
3505 LevelCheck(playerid, 4);
3506
3507 new
3508 string[130]
3509 ;
3510
3511 format(string, sizeof string, "Administrator "orange"%s "white"has saved all player's data.", pName(playerid));
3512 SendClientMessageToAll(-1, string);
3513 foreach(new i : Player)
3514 {
3515 if(User[i][accountLogged] == 1)
3516 {
3517 SaveData(i);
3518 }
3519 }
3520
3521 format(string, sizeof string, "Administrator %s has saved all player's data.", pName(playerid));
3522 SaveLog("account.txt", string);
3523 return 1;
3524}
3525
3526CMD:giveallweapon(playerid, params[])
3527{
3528 LoginCheck(playerid);
3529 LevelCheck(playerid, 4);
3530
3531 new
3532 ammo,
3533 wID[32],
3534 weap,
3535 WeapName[32],
3536 string[130]
3537 ;
3538 if(sscanf(params, "s[32]i", wID, ammo)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveallweapon [weaponid(or name)] [ammo]");
3539 if(ammo <= 0 || ammo > 99999) ammo = 500;
3540 if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
3541 else weap = strval(wID);
3542 if(!IsValidWeapon(weap)) return SendClientMessage(playerid, COLOR_RED, "* Invalid Weapon ID");
3543 GetWeaponName(weap, WeapName, 32);
3544 foreach(new i : Player)
3545 {
3546 GivePlayerWeapon(i, weap, ammo);
3547 format(string, sizeof string, "~g~%s for all!", WeapName);
3548 GameTextForPlayer(i, string, 2500, 3);
3549 }
3550 format(string,sizeof(string), "Admin %s(ID:%d) has given all players a %s(%d) with %d rounds of ammo.", pName(playerid), playerid, WeapName, weap, ammo);
3551 SendClientMessageToAll(COLOR_YELLOW, string);
3552 return 1;
3553}
3554
3555//============================================================================//
3556// Administrative Level Five //
3557//============================================================================//
3558
3559CMD:makemegodadmin(playerid, params[])
3560{
3561 if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "* Only RCON can use this command.");
3562 else
3563 {
3564 User[playerid][accountAdmin] = 5;
3565 SendClientMessage(playerid, COLOR_GREEN, "You have set your administrative rank to level 5.");
3566 }
3567 return 1;
3568}
3569
3570CMD:removeacc(playerid, params[])
3571{
3572 LoginCheck(playerid);
3573 LevelCheck(playerid, 5);
3574
3575 new
3576 Account[MAX_PLAYER_NAME],
3577 Reason[100],
3578 string[128]
3579 ;
3580 if(sscanf(params, "s[24]s[100]", Account, Reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /removeacc [account name] [reason]");
3581 if(DataExist(Account))
3582 {
3583 if(!strcmp(pName(playerid), Account, false))
3584 return SendClientMessage(playerid, COLOR_RED, "* You cannot delete your own account!");
3585
3586 foreach(new i : Player)
3587 {
3588 if(strcmp(Account, pName(i), true) == 0)
3589 {
3590 SendClientMessage(playerid, COLOR_RED, "* Player is online, fail to delete the account.");
3591 return 1;
3592 }
3593 }
3594
3595 new Query[128+50];
3596 format(Query, 100, "DELETE FROM `users` WHERE `username` = '%s'", Account);
3597 db_query(Database, Query);
3598 db_free_result(db_query(Database, Query));
3599
3600 format(string, 128, "Admin %s(ID: %d) has deleted %s's account [Reason: %s]", pName(playerid), playerid, Account, Reason);
3601 SendClientMessageToAll(COLOR_YELLOW, string);
3602 SaveLog("account.txt", string);
3603
3604 format(string, 128, "You have deleted %s's account [Reason: %s]", Account, Reason);
3605 SendClientMessage(playerid, COLOR_YELLOW, string);
3606 }
3607 else
3608 {
3609 SendClientMessage(playerid, COLOR_RED, "* Account does not exist in the database!");
3610 }
3611 return 1;
3612}
3613
3614CMD:fakecmd(playerid, params[])
3615{
3616 new
3617 string[128],
3618 id,
3619 cmdtext[128]
3620 ;
3621
3622 LoginCheck(playerid);
3623 LevelCheck(playerid, 5);
3624
3625 if(sscanf(params, "us[128]", id, cmdtext)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakecmd [playerid] [command]");
3626 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3627 if(strfind(params, "/", false) != -1)
3628 {
3629 CallRemoteFunction("OnPlayerCommandText", "is", id, cmdtext);
3630 format(string, sizeof(string), "Fake command sent to %s with %s", pName(id), cmdtext);
3631 SendClientMessage(playerid, COLOR_YELLOW, string);
3632 }
3633 else return SendClientMessage(playerid, COLOR_RED, "* Add '/' before putting the command name to avoid the command unknown error.");
3634 return 1;
3635}
3636
3637CMD:fakechat(playerid, params[])
3638{
3639 LoginCheck(playerid);
3640 LevelCheck(playerid, 5);
3641
3642 new
3643 string[130],
3644 id,
3645 text[128]
3646 ;
3647
3648 if(sscanf(params, "us[128]", id, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /fakechat [playerid] [text]");
3649 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3650 format(string, sizeof(string), "You have faked chat %s with %s", pName(id), text);
3651 SendClientMessage(playerid, COLOR_YELLOW, string);
3652 SendPlayerMessageToAll(id, text);
3653 return 1;
3654}
3655
3656CMD:setlevel(playerid, params[])
3657{
3658 new
3659 string[128],
3660 id,
3661 level
3662 ;
3663
3664 LoginCheck(playerid);
3665 LevelCheck(playerid, 5);
3666
3667 if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setlevel [playerid] [level(0/5)]");
3668 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3669 if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_RED, "* Levels shouldn't go below zero and shouldn't go above five.");
3670 if(level == User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* Player is already in that level.");
3671 if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
3672
3673 if(User[id][accountAdmin] < level)
3674 {
3675 format(string, 128, "You have been promoted to level %d by %s.", level, pName(playerid));
3676 SendClientMessage(id, COLOR_YELLOW, string);
3677 format(string, 128, "You have promoted %s to level %d.", pName(id), level);
3678 SendClientMessage(playerid, COLOR_YELLOW, string);
3679 }
3680 else if(User[id][accountAdmin] > level)
3681 {
3682 format(string, 128, "You have been demoted to level %d by %s.", level, pName(playerid));
3683 SendClientMessage(id, COLOR_YELLOW, string);
3684 format(string, 128, "You have demoted %s to level %d.", pName(id), level);
3685 SendClientMessage(playerid, COLOR_YELLOW, string);
3686 }
3687
3688 User[id][accountAdmin] = level;
3689
3690 format(string, sizeof string, "Administrator %s has set %s's administrative level to %d", pName(playerid), pName(id), level);
3691 SaveLog("account.txt", string);
3692
3693 SaveData(id); //Saving the whole data
3694 return 1;
3695}
3696
3697#if VipSystem == true
3698 CMD:setvip(playerid, params[])
3699 {
3700 new
3701 string[128],
3702 id,
3703 level
3704 ;
3705
3706 LoginCheck(playerid);
3707 LevelCheck(playerid, 5);
3708
3709 if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [playerid] [level(0/3)]");
3710 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3711 if(level < 0 || level > 3) return SendClientMessage(playerid, COLOR_RED, "* Levels shouldn't go below zero and shouldn't go above three.");
3712 if(level == accountVip[id]) return SendClientMessage(playerid, COLOR_RED, "* Player is already in that level.");
3713 if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "* Player not logged in.");
3714
3715 if(accountVip[id] < level)
3716 {
3717 format(string, 128, "You have been promoted to VIP level %d by %s.", level, pName(playerid));
3718 SendClientMessage(id, COLOR_YELLOW, string);
3719 format(string, 128, "You have promoted %s to VIP level %d.", pName(id), level);
3720 SendClientMessage(playerid, COLOR_YELLOW, string);
3721 }
3722 else if(accountVip[id] > level)
3723 {
3724 format(string, 128, "You have been demoted to VIP level %d by %s.", level, pName(playerid));
3725 SendClientMessage(id, COLOR_YELLOW, string);
3726 format(string, 128, "You have demoted %s to VIP level %d.", pName(id), level);
3727 SendClientMessage(playerid, COLOR_YELLOW, string);
3728 }
3729
3730 accountVip[id] = level;
3731
3732 format(string, sizeof string, "Administrator %s has set %s's vip level to %d", pName(playerid), pName(id), level);
3733 SaveLog("account.txt", string);
3734
3735 SaveData(id); //Saving the whole data
3736 return 1;
3737 }
3738#endif
3739
3740//============================================================================//
3741// Administrative Level Zero //
3742//============================================================================//
3743
3744#if VipSystem == true
3745 CMD:vips(playerid, params[])
3746 {
3747 new string[128 * 10], count = 0;
3748
3749 foreach(new i : Player)
3750 {
3751 if(User[i][accountLogged] && accountVip[i] >= 1)
3752 {
3753 format(string, sizeof(string), "%s(%d) %s - %s\n", string, i, pName(i), GetVIPRank(accountVip[i]));
3754 count++;
3755 }
3756 }
3757
3758 if(count == 0)
3759 return SendClientMessage(playerid, -1, "No VIPs online at the server.");
3760
3761 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, "VIPs", string, "CLOSE", "");
3762 return 1;
3763 }
3764#endif
3765
3766CMD:admins(playerid, params[])
3767{
3768 new string[128 * 10], count = 0;
3769
3770 foreach(new i : Player)
3771 {
3772 if(User[i][accountLogged] && User[i][accountAdmin] >= 1)
3773 {
3774 if(User[i][accountAdmin] >= 1)
3775 {
3776 format(string, sizeof(string), "%s(%d) %s - %s\n", string, i, pName(i), GetAdminRank(User[i][accountAdmin]));
3777 count++;
3778 }
3779 }
3780 }
3781
3782 if(count == 0)
3783 return SendClientMessage(playerid, -1, "No administrators online at the server.");
3784
3785 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, "ADMINs", string, "CLOSE", "");
3786 return 1;
3787}
3788
3789CMD:jcredits(playerid, params[])
3790{
3791 SendClientMessage(playerid, COLOR_GREEN, "JaKe's Administration System "VERSION" Credits to:");
3792 SendClientMessage(playerid, -1, "_Jake_, Y_Less, DracoBlue, Zeex, Zher0, Lordzy");
3793 SendClientMessage(playerid, COLOR_YELLOW, "Ranveer, Samp_India, Ashirwad, Sonic, Adham, MaxFranky and others who helped us.");
3794 return 1;
3795}
3796
3797CMD:savestats(playerid, params[])
3798{
3799 LoginCheck(playerid);
3800
3801 if(!DataExist(pName(playerid))) return SendClientMessage(playerid, COLOR_RED, "* You do not have account.");
3802
3803 SaveData(playerid);
3804
3805 SendClientMessage(playerid, COLOR_GREEN, "ACCOUNT: Your account statistics has been saved manually.");
3806 return 1;
3807}
3808
3809CMD:cquestion(playerid, params[])
3810{
3811 LoginCheck(playerid);
3812
3813 new hashpass[129];
3814
3815 if(isnull(params))
3816 return SendClientMessage(playerid, COLOR_YELLOW, "* Input your password first before changing the security question, /cquestion [password]");
3817
3818 WP_Hash(hashpass, sizeof(hashpass), params);
3819 if(!strcmp(hashpass, User[playerid][accountPassword], false))
3820 {
3821 SendClientMessage(playerid, COLOR_GREEN, "* You are the owner of this account, You may pass through.");
3822 ShowPlayerDialog(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"* Type in your new security question below;", "Set", "Cancel");
3823 }
3824 else
3825 {
3826 format(hashpass, sizeof(hashpass), "* \"%s\" isn't the password.", params);
3827 SendClientMessage(playerid, COLOR_YELLOW, hashpass);
3828 }
3829 return 1;
3830}
3831
3832CMD:jcmds(playerid, params[])
3833{
3834 new string[1246];
3835
3836 LoginCheck(playerid);
3837
3838 strcat(string, ""orange"");
3839 strcat(string, "Listing all available commands of JakAdmin 3.4.1\n\n");
3840
3841 strcat(string, ""grey"");
3842 #if VipSystem == true
3843 strcat(string, "/stats /cpass /register /login /report /admins /jcredits /savestats /vips /cquestion");
3844 #else
3845 strcat(string, "/stats /cpass /register /login /report /admins /jcredits /savestats /cquestion");
3846 #endif
3847
3848 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""orange"Player Commands", string, "Close", "");
3849 return 1;
3850}
3851
3852CMD:report(playerid, params[])
3853{
3854 new id, reason[128], string[136];
3855 if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [playerid] [reason]");
3856 if(strlen(reason) <= 4) return SendClientMessage(playerid, COLOR_RED, "* Reason length shouldn't go lower than four.");
3857 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
3858 if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You cannot report yourself.");
3859 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
3860 new r_hr, r_min, r_sec, r_m, r_d, r_y;
3861 getdate(r_y, r_m, r_d);
3862 gettime(r_hr, r_min, r_sec);
3863
3864 reportmsg[3] = reportmsg[2];
3865 reportmsg[2] = reportmsg[1];
3866 reportmsg[1] = reportmsg[0];
3867
3868 format(string, sizeof(string), "(%02d/%02d/%d - %02d:%02d:%02d) %s(ID:%d) has reported %s(ID:%d) for %s", r_m, r_d, r_y, r_hr, r_min, r_sec, pName(playerid), playerid, pName(id), id, reason);
3869 reportmsg[0] = string;
3870
3871 format(string, sizeof(string), "REPORT: %s(ID:%d) has reported %s(ID:%d) for %s", pName(playerid), playerid, pName(id), id, reason);
3872 SendAdmin(COLOR_RED, string);
3873
3874 foreach(new i : Player)
3875 {
3876 if(User[i][accountLogged] == 1)
3877 {
3878 if(User[i][accountAdmin] >= 1)
3879 {
3880 PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
3881 }
3882 }
3883 }
3884
3885 format(string, sizeof(string), "Your complaint against %s(ID:%d) %s has been sent to Online Admins.", pName(id), id, reason);
3886 SendClientMessage(playerid, COLOR_YELLOW, string);
3887 return 1;
3888}
3889
3890CMD:register(playerid, params[])
3891{
3892 if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "* You are logged in and registered already.");
3893
3894 if(!DataExist(pName(playerid)))
3895 {
3896 new
3897 password[24],
3898 hashpass[129]
3899 ;
3900
3901 if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /register [password]");
3902 if(!IsValidPassword(password)) return SendClientMessage(playerid, COLOR_RED, "* Invalid Password Symbols.");
3903 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.");
3904
3905 WP_Hash(hashpass, 129, password);
3906 RegisterPlayer(playerid, hashpass);
3907 }
3908 else
3909 {
3910 SendClientMessage(playerid, COLOR_RED, "* You already have an account, /login instead.");
3911 }
3912 return 1;
3913}
3914
3915CMD:login(playerid, params[])
3916{
3917 if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "* You are logged in already.");
3918
3919 if(DataExist(pName(playerid)))
3920 {
3921 new
3922 hashp[129],
3923 string[900],
3924 password[24]
3925 ;
3926
3927 if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [password]");
3928
3929 if(strcmp(password, "forget", true) == 0)
3930 {
3931 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
3932 return SendClientMessage(playerid, COLOR_RED, "* You haven't set a security question & answer on your account.");
3933
3934 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.", User[playerid][accountQuestion]);
3935 ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
3936 return 1;
3937 }
3938
3939 WP_Hash(hashp, 129, password);
3940 if(!strcmp(hashp, User[playerid][accountPassword], false))
3941 {
3942 LoginPlayer(playerid);
3943 }
3944 else
3945 {
3946 User[playerid][WarnLog]++;
3947
3948 if(User[playerid][WarnLog] >= ServerInfo[LoginWarn])
3949 {
3950 ShowPlayerDialog(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", "");
3951 KickDelay(playerid);
3952 return 1;
3953 }
3954
3955 format(string, sizeof(string), "Invalid password! - %d out of %d Warning Log Tires.", User[playerid][WarnLog], ServerInfo[LoginWarn]);
3956 SendClientMessage(playerid, COLOR_RED, string);
3957
3958 SendClientMessage(playerid, -1, "LOGIN: Try again, /login [password].");
3959 }
3960 }
3961 else
3962 {
3963 SendClientMessage(playerid, COLOR_RED, "* You do not have an account, /register first.");
3964 }
3965 return 1;
3966}
3967
3968CMD:cpass(playerid, params[])
3969{
3970 LoginCheck(playerid);
3971
3972 new OldPass[129], NewPass[129], string[128];
3973 if(sscanf(params, "s[24]s[24]", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /cpass [old pass] [new pass]");
3974 if(strlen(NewPass) < 4 || strlen(NewPass) > 20)
3975 return SendClientMessage(playerid, COLOR_RED, "* New password length shouldn't go below four and shouldn't go below twenty.");
3976
3977 new Query[300], DBResult:Result, Buf[129];
3978 WP_Hash(Buf, 129, OldPass);
3979 format(Query, 300, "SELECT `userid` FROM `users` WHERE `username` = '%s' AND `password` = '%s'", User[playerid][accountName], Buf);
3980 Result = db_query(Database, Query);
3981
3982 format(string, sizeof string, "Player %s has changed his/her password.", pName(playerid));
3983 SaveLog("account.txt", string);
3984
3985 if(Result)
3986 {
3987 if(db_num_rows(Result))
3988 {
3989 db_free_result(Result);
3990 WP_Hash(Buf, 129, NewPass);
3991 format(Query, 300, "UPDATE `users` SET `password` = '%s' WHERE `username` = '%s'", DB_Escape(Buf), DB_Escape(User[playerid][accountName]));
3992 db_query(Database, Query);
3993
3994 format(string, 128, "Your password has been changed to '"orange"%s"white"'", NewPass);
3995 SendClientMessage(playerid, -1, string);
3996 }
3997 else
3998 {
3999 db_free_result(Result);
4000 return SendClientMessage(playerid, COLOR_RED, "* Old Password doesn't match on the current password!");
4001 }
4002 }
4003 return 1;
4004}
4005
4006CMD:stats(playerid, params[])
4007{
4008 LoginCheck(playerid);
4009
4010 new id;
4011 if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /stats [playerid]");
4012 if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player not connected.");
4013 if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You cannot use this command on higher admin.");
4014
4015 ShowStatistics(playerid, id); //Show the statistics to yourself.
4016 return 1;
4017}
4018
4019// //
4020//============================================================================//
4021
4022public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
4023{
4024 return 1;
4025}
4026
4027public OnPlayerExitVehicle(playerid, vehicleid)
4028{
4029 return 1;
4030}
4031
4032public OnPlayerStateChange(playerid, newstate, oldstate)
4033{
4034 new vehicleid = GetPlayerVehicleID(playerid);
4035
4036 if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
4037 {
4038 foreach(new x : Player)
4039 {
4040 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE)
4041 {
4042 TogglePlayerSpectating(x, 1);
4043 PlayerSpectatePlayer(x, playerid);
4044 User[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
4045 }
4046 }
4047 }
4048
4049 if(newstate == PLAYER_STATE_PASSENGER)
4050 {
4051 foreach(new x : Player)
4052 {
4053 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
4054 {
4055 TogglePlayerSpectating(x, 1);
4056 PlayerSpectateVehicle(x, vehicleid);
4057 User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
4058 }
4059 }
4060 }
4061
4062 if(newstate == PLAYER_STATE_DRIVER)
4063 {
4064 foreach(new x : Player)
4065 {
4066 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
4067 {
4068 TogglePlayerSpectating(x, 1);
4069 PlayerSpectateVehicle(x, vehicleid);
4070 User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
4071 }
4072 }
4073 }
4074 return 1;
4075}
4076
4077public OnPlayerRequestSpawn(playerid)
4078{
4079 if(User[playerid][accountLogged] == 0)
4080 {
4081 SendClientMessage(playerid, COLOR_RED, "* You need to login or register to spawn.");
4082 return 0;
4083 }
4084 return 1;
4085}
4086
4087public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
4088{
4089 foreach(new x : Player)
4090 {
4091 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
4092 {
4093 SetPlayerInterior(x,newinteriorid);
4094 }
4095 }
4096 return 1;
4097}
4098
4099public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
4100{
4101 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
4102 {
4103 if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
4104 else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
4105 }
4106 return 1;
4107}
4108
4109#if RconProtect == true
4110 public OnPlayerRconLogin(playerid)
4111 {
4112 if(_RCON[playerid] == false)
4113 {
4114 SendClientMessage(playerid, COLOR_YELLOW, "The server has 2nd Rcon, Protected by JakAdmin");
4115 ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by JakAdmin3\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
4116 }
4117 return 1;
4118 }
4119#endif
4120
4121public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
4122{
4123 switch( dialogid )
4124 {
4125 #if RconProtect == true
4126 case DIALOG_RCON:
4127 {
4128 new
4129 string[130]
4130 ;
4131 if(!response)
4132 {
4133 format(string, sizeof(string), "** Player %s(ID:%d) has been automatically kicked by the Server (Attempting to logged in RCON)", pName(playerid), playerid);
4134 SendClientMessageToAll(COLOR_GREY, string);
4135 print(string);
4136 SaveLog("rcon.txt", string);
4137 return KickDelay(playerid);
4138 }
4139 if(response)
4140 {
4141 if(!strcmp(RconPass, inputtext) && !(!strlen(inputtext)))
4142 {
4143 format(string, sizeof(string), "** Player %s(ID:%d) has accessed the RCON Protection successfully!", pName(playerid), playerid);
4144 SendAdmin(COLOR_GREY, string);
4145 print(string);
4146 SaveLog("rcon.txt", string);
4147
4148 _RCON[playerid] = true;
4149
4150 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~g~Authorized ~w~Access!~n~~y~Welcome Administrator!", 3000, 3);
4151 }
4152 else
4153 {
4154 if(_RCONwarn[playerid] == MAX_RCON_WARNINGS+1)
4155 {
4156 format(string, sizeof(string), "** Player %s(ID:%d) has been kicked by the Server (Attempting to logged in RCON)", pName(playerid), playerid);
4157 SendClientMessageToAll(COLOR_GREY, string);
4158 print(string);
4159 SaveLog("kicklog.txt", string);
4160 KickDelay(playerid);
4161 return 1;
4162 }
4163 _RCONwarn[playerid] ++;
4164 format(string, sizeof(string), "You have been warned for incorrect 2nd RCON Password (Warnings: %i/%i)", _RCONwarn[playerid], MAX_RCON_WARNINGS);
4165 SendClientMessage(playerid, COLOR_GREY, string);
4166 ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by JakAdmin3\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
4167 }
4168 }
4169 }
4170 #endif
4171
4172 case DIALOG_PING:
4173 {
4174 new string[128];
4175
4176 if(response)
4177 {
4178 if(!strlen(inputtext))
4179 return ShowPlayerDialog(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");
4180
4181 if(!isnumeric(inputtext))
4182 return ShowPlayerDialog(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");
4183
4184 if(strval(inputtext) < 0)
4185 return ShowPlayerDialog(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");
4186
4187 ServerInfo[MaxPing] = strval(inputtext);
4188 SaveConfig();
4189
4190 format(string, sizeof(string), "* Administrator %s has set the Maximum Ping to (%d).", pName(playerid), ServerInfo[MaxPing]);
4191 SendAdmin(COLOR_YELLOW, string);
4192 }
4193 else
4194 {
4195 ShowSettings(playerid);
4196 }
4197 }
4198 case DIALOG_PING_WARN:
4199 {
4200 new string[128];
4201
4202 if(response)
4203 {
4204 if(!strlen(inputtext))
4205 return ShowPlayerDialog(playerid, DIALOG_PING_WARN, DIALOG_STYLE_INPUT, "Ping Warn", "Place in the maximum ping warning before the player gets kicked;", "Set", "Back");
4206
4207 if(!isnumeric(inputtext))
4208 return ShowPlayerDialog(playerid, DIALOG_PING_WARN, DIALOG_STYLE_INPUT, "Ping Warn", "Place in the maximum ping warning before the player gets kicked;", "Set", "Back");
4209
4210 if(strval(inputtext) < 1)
4211 return ShowPlayerDialog(playerid, DIALOG_PING_WARN, DIALOG_STYLE_INPUT, "Ping Warn", "Place in the maximum ping warning before the player gets kicked;", "Set", "Back");
4212
4213 ServerInfo[MaxPingWarn] = strval(inputtext);
4214 SaveConfig();
4215
4216 format(string, sizeof(string), "* Administrator %s has set the Maximum Ping Warning to (%d).", pName(playerid), ServerInfo[MaxPingWarn]);
4217 SendAdmin(COLOR_YELLOW, string);
4218 }
4219 else
4220 {
4221 ShowSettings(playerid);
4222 }
4223 }
4224 case DIALOG_LOG_TRIES:
4225 {
4226 new string[128];
4227
4228 if(response)
4229 {
4230 if(!strlen(inputtext))
4231 return ShowPlayerDialog(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");
4232
4233 if(!isnumeric(inputtext))
4234 return ShowPlayerDialog(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");
4235
4236 if(strval(inputtext) < 1)
4237 return ShowPlayerDialog(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");
4238
4239 ServerInfo[LoginWarn] = strval(inputtext);
4240 SaveConfig();
4241
4242 format(string, sizeof(string), "* Administrator %s has set the Maximum Login Tries to (%d).", pName(playerid), ServerInfo[LoginWarn]);
4243 SendAdmin(COLOR_YELLOW, string);
4244 }
4245 else
4246 {
4247 ShowSettings(playerid);
4248 }
4249 }
4250 case DIALOG_SEC_TRIES:
4251 {
4252 new string[128];
4253
4254 if(response)
4255 {
4256 if(!strlen(inputtext))
4257 return ShowPlayerDialog(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");
4258
4259 if(!isnumeric(inputtext))
4260 return ShowPlayerDialog(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");
4261
4262 if(strval(inputtext) < 1)
4263 return ShowPlayerDialog(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");
4264
4265 ServerInfo[SecureWarn] = strval(inputtext);
4266 SaveConfig();
4267
4268 format(string, sizeof(string), "* Administrator %s has set the Maximum Security Question Tries to (%d).", pName(playerid), ServerInfo[SecureWarn]);
4269 SendAdmin(COLOR_YELLOW, string);
4270 }
4271 else
4272 {
4273 ShowSettings(playerid);
4274 }
4275 }
4276 case DIALOG_RANKS:
4277 {
4278 if(response)
4279 {
4280 switch(listitem)
4281 {
4282 case 0: ShowPlayerDialog(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");
4283 case 1: ShowPlayerDialog(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");
4284 case 2: ShowPlayerDialog(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");
4285 case 3: ShowPlayerDialog(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");
4286 case 4: ShowPlayerDialog(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");
4287 #if VipSystem == true
4288 case 5: ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_1, DIALOG_STYLE_INPUT, "Editing; VIP Rank 1", "You are now editing VIP Rank #1;\n\n* Type in the new rank name for vip level 1.", "Set", "Back");
4289 case 6: ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_2, DIALOG_STYLE_INPUT, "Editing; VIP Rank 2", "You are now editing VIP Rank #2;\n\n* Type in the new rank name for vip level 2.", "Set", "Back");
4290 case 7: ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_3, DIALOG_STYLE_INPUT, "Editing; VIP Rank 3", "You are now editing VIP Rank #3;\n\n* Type in the new rank name for vip level 3.", "Set", "Back");
4291 #endif
4292 }
4293 }
4294 else
4295 {
4296 ShowSettings(playerid);
4297 }
4298 }
4299 #if VipSystem == true
4300 case DIALOG_EDIT_VIP_1:
4301 {
4302 if(response)
4303 {
4304 if(!strlen(inputtext))
4305 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_1, DIALOG_STYLE_INPUT, "Editing; VIP Rank 1", "You are now editing VIP Rank #1;\n\n* Type in the new rank name for vip level 1.", "Set", "Back");
4306
4307 if(strlen(inputtext) > 63)
4308 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_1, DIALOG_STYLE_INPUT, "Editing; VIP Rank 1", "You are now editing VIP Rank #1;\n\n* Type in the new rank name for vip level 1.", "Set", "Back");
4309
4310 format(ServerInfo[VipRank1], 256, inputtext);
4311 SaveConfig();
4312 ShowRanks(playerid);
4313 }
4314 else
4315 {
4316 ShowRanks(playerid);
4317 }
4318 }
4319 case DIALOG_EDIT_VIP_2:
4320 {
4321 if(response)
4322 {
4323 if(!strlen(inputtext))
4324 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_2, DIALOG_STYLE_INPUT, "Editing; VIP Rank 2", "You are now editing VIP Rank #2;\n\n* Type in the new rank name for vip level 2.", "Set", "Back");
4325
4326 if(strlen(inputtext) > 63)
4327 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_2, DIALOG_STYLE_INPUT, "Editing; VIP Rank 2", "You are now editing VIP Rank #2;\n\n* Type in the new rank name for vip level 2.", "Set", "Back");
4328
4329 format(ServerInfo[VipRank2], 256, inputtext);
4330 SaveConfig();
4331 ShowRanks(playerid);
4332 }
4333 else
4334 {
4335 ShowRanks(playerid);
4336 }
4337 }
4338 case DIALOG_EDIT_VIP_3:
4339 {
4340 if(response)
4341 {
4342 if(!strlen(inputtext))
4343 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_3, DIALOG_STYLE_INPUT, "Editing; VIP Rank 3", "You are now editing VIP Rank #3;\n\n* Type in the new rank name for vip level 3.", "Set", "Back");
4344
4345 if(strlen(inputtext) > 63)
4346 return ShowPlayerDialog(playerid, DIALOG_EDIT_VIP_3, DIALOG_STYLE_INPUT, "Editing; VIP Rank 3", "You are now editing VIP Rank #3;\n\n* Type in the new rank name for vip level 3.", "Set", "Back");
4347
4348 format(ServerInfo[VipRank3], 256, inputtext);
4349 SaveConfig();
4350 ShowRanks(playerid);
4351 }
4352 else
4353 {
4354 ShowRanks(playerid);
4355 }
4356 }
4357 #endif
4358 case DIALOG_EDIT_ADMIN_1:
4359 {
4360 if(response)
4361 {
4362 if(!strlen(inputtext))
4363 return ShowPlayerDialog(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");
4364
4365 if(strlen(inputtext) > 63)
4366 return ShowPlayerDialog(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");
4367
4368 format(ServerInfo[AdminRank1], 256, inputtext);
4369 SaveConfig();
4370 ShowRanks(playerid);
4371 }
4372 else
4373 {
4374 ShowRanks(playerid);
4375 }
4376 }
4377 case DIALOG_EDIT_ADMIN_2:
4378 {
4379 if(response)
4380 {
4381 if(!strlen(inputtext))
4382 return ShowPlayerDialog(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");
4383
4384 if(strlen(inputtext) > 63)
4385 return ShowPlayerDialog(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");
4386
4387 format(ServerInfo[AdminRank2], 256, inputtext);
4388 SaveConfig();
4389 ShowRanks(playerid);
4390 }
4391 else
4392 {
4393 ShowRanks(playerid);
4394 }
4395 }
4396 case DIALOG_EDIT_ADMIN_3:
4397 {
4398 if(response)
4399 {
4400 if(!strlen(inputtext))
4401 return ShowPlayerDialog(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");
4402
4403 if(strlen(inputtext) > 63)
4404 return ShowPlayerDialog(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");
4405
4406 format(ServerInfo[AdminRank3], 256, inputtext);
4407 SaveConfig();
4408 ShowRanks(playerid);
4409 }
4410 else
4411 {
4412 ShowRanks(playerid);
4413 }
4414 }
4415 case DIALOG_EDIT_ADMIN_4:
4416 {
4417 if(response)
4418 {
4419 if(!strlen(inputtext))
4420 return ShowPlayerDialog(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");
4421
4422 if(strlen(inputtext) > 63)
4423 return ShowPlayerDialog(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");
4424
4425 format(ServerInfo[AdminRank4], 256, inputtext);
4426 SaveConfig();
4427 ShowRanks(playerid);
4428 }
4429 else
4430 {
4431 ShowRanks(playerid);
4432 }
4433 }
4434 case DIALOG_EDIT_ADMIN_5:
4435 {
4436 if(response)
4437 {
4438 if(!strlen(inputtext))
4439 return ShowPlayerDialog(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");
4440
4441 if(strlen(inputtext) > 63)
4442 return ShowPlayerDialog(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");
4443
4444 format(ServerInfo[AdminRank5], 256, inputtext);
4445 SaveConfig();
4446 ShowRanks(playerid);
4447 }
4448 else
4449 {
4450 ShowRanks(playerid);
4451 }
4452 }
4453 case DIALOG_SETTINGS:
4454 {
4455 new string[128];
4456
4457 if(response)
4458 {
4459 switch(listitem)
4460 {
4461 case 0: // Save Log
4462 {
4463 switch(ServerInfo[SaveLogs])
4464 {
4465 case 0:
4466 {
4467 format(string, sizeof(string), "* Administrator %s has enable the Save Log Files feature (/jsettings)", pName(playerid));
4468 SendAdmin(COLOR_YELLOW, string);
4469 ServerInfo[SaveLogs] = 1;
4470 SaveConfig();
4471 }
4472 case 1:
4473 {
4474 format(string, sizeof(string), "* Administrator %s has disable the Save Log Files feature (/jsettings)", pName(playerid));
4475 SendAdmin(COLOR_YELLOW, string);
4476 ServerInfo[SaveLogs] = 0;
4477 SaveConfig();
4478 }
4479 }
4480 ShowSettings(playerid);
4481 }
4482 case 1: // Login Tries
4483 {
4484 ShowPlayerDialog(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");
4485 }
4486 case 2: // Secure Tries
4487 {
4488 ShowPlayerDialog(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");
4489 }
4490 case 3: // AutoLogin
4491 {
4492 switch(ServerInfo[AutoLogin])
4493 {
4494 case 0:
4495 {
4496 format(string, sizeof(string), "* Administrator %s has enable the Auto Login feature (/jsettings)", pName(playerid));
4497 SendAdmin(COLOR_YELLOW, string);
4498 ServerInfo[AutoLogin] = 1;
4499 SaveConfig();
4500 }
4501 case 1:
4502 {
4503 format(string, sizeof(string), "* Administrator %s has disable the Auto Login feature (/jsettings)", pName(playerid));
4504 SendAdmin(COLOR_YELLOW, string);
4505 ServerInfo[AutoLogin] = 0;
4506 SaveConfig();
4507 }
4508 }
4509 ShowSettings(playerid);
4510 }
4511 case 4: // Read Commands
4512 {
4513 switch(ServerInfo[ReadCmds])
4514 {
4515 case 0:
4516 {
4517 format(string, sizeof(string), "* Administrator %s has enable the Read Player Commands feature (/jsettings)", pName(playerid));
4518 SendAdmin(COLOR_YELLOW, string);
4519 ServerInfo[ReadCmds] = 1;
4520 SaveConfig();
4521 }
4522 case 1:
4523 {
4524 format(string, sizeof(string), "* Administrator %s has disable the Read Player Commands feature (/jsettings)", pName(playerid));
4525 SendAdmin(COLOR_YELLOW, string);
4526 ServerInfo[ReadCmds] = 0;
4527 SaveConfig();
4528 }
4529 }
4530 ShowSettings(playerid);
4531 }
4532 case 5: // Ping Kicker
4533 {
4534 ShowPlayerDialog(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");
4535 }
4536 case 6: // Ping Warn
4537 {
4538 ShowPlayerDialog(playerid, DIALOG_PING_WARN, DIALOG_STYLE_INPUT, "Ping Warn", "Place in the maximum ping warning before the player gets kicked;", "Set", "Back");
4539 }
4540 case 7: // Anti Swear
4541 {
4542 switch(ServerInfo[AntiSwear])
4543 {
4544 case 0:
4545 {
4546 format(string, sizeof(string), "* Administrator %s has enable the Anti-Swearing feature (/jsettings)", pName(playerid));
4547 SendAdmin(COLOR_YELLOW, string);
4548 ServerInfo[AntiSwear] = 1;
4549 SaveConfig();
4550 }
4551 case 1:
4552 {
4553 format(string, sizeof(string), "* Administrator %s has disable the Anti-Swearing feature (/jsettings)", pName(playerid));
4554 SendAdmin(COLOR_YELLOW, string);
4555 ServerInfo[AntiSwear] = 0;
4556 SaveConfig();
4557 }
4558 }
4559 ShowSettings(playerid);
4560 }
4561 case 8: // Anti Name
4562 {
4563 switch(ServerInfo[AntiName])
4564 {
4565 case 0:
4566 {
4567 format(string, sizeof(string), "* Administrator %s has enable the Anti-Name feature (/jsettings)", pName(playerid));
4568 SendAdmin(COLOR_YELLOW, string);
4569 ServerInfo[AntiName] = 1;
4570 SaveConfig();
4571 }
4572 case 1:
4573 {
4574 format(string, sizeof(string), "* Administrator %s has disable the Anti-Name feature (/jsettings)", pName(playerid));
4575 SendAdmin(COLOR_YELLOW, string);
4576 ServerInfo[AntiName] = 0;
4577 SaveConfig();
4578 }
4579 }
4580 ShowSettings(playerid);
4581 }
4582 case 9: // Anti Ad
4583 {
4584 switch(ServerInfo[AntiAd])
4585 {
4586 case 0:
4587 {
4588 format(string, sizeof(string), "* Administrator %s has enable the Anti-Advertisement feature (/jsettings)", pName(playerid));
4589 SendAdmin(COLOR_YELLOW, string);
4590 ServerInfo[AntiAd] = 1;
4591 SaveConfig();
4592 }
4593 case 1:
4594 {
4595 format(string, sizeof(string), "* Administrator %s has disable the Anti-Advertisement feature (/jsettings)", pName(playerid));
4596 SendAdmin(COLOR_YELLOW, string);
4597 ServerInfo[AntiAd] = 0;
4598 SaveConfig();
4599 }
4600 }
4601 ShowSettings(playerid);
4602 }
4603 case 10: // Anti Spam
4604 {
4605 switch(ServerInfo[AntiSpam])
4606 {
4607 case 0:
4608 {
4609 format(string, sizeof(string), "* Administrator %s has enable the Anti-Spam feature (/jsettings)", pName(playerid));
4610 SendAdmin(COLOR_YELLOW, string);
4611 ServerInfo[AntiSpam] = 1;
4612 SaveConfig();
4613 }
4614 case 1:
4615 {
4616 format(string, sizeof(string), "* Administrator %s has disable the Anti-Spam feature (/jsettings)", pName(playerid));
4617 SendAdmin(COLOR_YELLOW, string);
4618 ServerInfo[AntiSpam] = 0;
4619 SaveConfig();
4620 }
4621 }
4622 ShowSettings(playerid);
4623 }
4624 case 11: // Ranks
4625 {
4626 ShowRanks(playerid);
4627 }
4628 }
4629 }
4630 }
4631 case DIALOG_WOULDYOU:
4632 {
4633 if(response)
4634 {
4635 ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
4636 }
4637 else
4638 {
4639 SendClientMessage(playerid, COLOR_RED, "* You decided not to set a security question on your account.");
4640 }
4641 }
4642 case DIALOG_QUESTION:
4643 {
4644 if(!response)
4645 {
4646 ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
4647 }
4648 else
4649 {
4650 if(strlen(inputtext) < 6 || strlen(inputtext) > 90)
4651 {
4652 ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
4653 return 1;
4654 }
4655 if(strcmp(inputtext, "none", true) == 0)
4656 {
4657 ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"You can use the Security Question incase you forgot your password.\n\n* Type in your security question below;", "Setup", "");
4658 return 1;
4659 }
4660
4661 format(User[playerid][accountQuestion], 92, "%s", inputtext);
4662 SaveData(playerid);
4663
4664 ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
4665 }
4666 }
4667 case DIALOG_ANSWER:
4668 {
4669 if(!response)
4670 {
4671 ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
4672 }
4673 else
4674 {
4675 if(strlen(inputtext) < 2 || strlen(inputtext) > 90)
4676 {
4677 ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\n\n* Type in your security answer below:", "Setup", "");
4678 return 1;
4679 }
4680
4681 new hashanswer[129];
4682 WP_Hash(hashanswer, 129, inputtext);
4683 format(User[playerid][accountAnswer], 129, "%s", hashanswer);
4684
4685 SendClientMessage(playerid, COLOR_YELLOW, "* You have successfully set your Security Question & Answer, Use the forget feature when you forgot your password.");
4686 SaveData(playerid);
4687 }
4688 }
4689 case DIALOG_QUESTION2:
4690 {
4691 if(response)
4692 {
4693 if(strlen(inputtext) < 6 || strlen(inputtext) > 90)
4694 {
4695 ShowPlayerDialog(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"* Type in your new security question below;", "Set", "Cancel");
4696 return 1;
4697 }
4698
4699 format(User[playerid][accountQuestion], 92, "%s", inputtext);
4700 SaveData(playerid);
4701
4702 ShowPlayerDialog(playerid, DIALOG_ANSWER2, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"* Type in your security answer below:", "Set", "Back");
4703 }
4704 }
4705 case DIALOG_ANSWER2:
4706 {
4707 if(!response)
4708 {
4709 ShowPlayerDialog(playerid, DIALOG_QUESTION2, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"* Type in your new security question below;", "Set", "Cancel");
4710 }
4711 else
4712 {
4713 if(strlen(inputtext) < 2 || strlen(inputtext) > 90)
4714 {
4715 ShowPlayerDialog(playerid, DIALOG_ANSWER2, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"* Type in your security answer below:", "Set", "Back");
4716 return 1;
4717 }
4718
4719 new hashanswer[129];
4720 WP_Hash(hashanswer, 129, inputtext);
4721 format(User[playerid][accountAnswer], 129, "%s", hashanswer);
4722
4723 SendClientMessage(playerid, COLOR_YELLOW, "* You have successfully set your new Security Question & Answer.");
4724 SaveData(playerid);
4725 }
4726 }
4727 case DIALOG_REGISTER:
4728 {
4729 new
4730 hashpass[129]
4731 ;
4732
4733 if(response)
4734 {
4735 if(!IsValidPassword(inputtext))
4736 {
4737 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Invalid Password Symbols.", "Register", "Quit");
4738 return 0;
4739 }
4740 if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
4741 {
4742 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Password length shouldn't go below 4 and shouldn't go higher 20.", "Register", "Quit");
4743 return 0;
4744 }
4745
4746 WP_Hash(hashpass, 129, inputtext);
4747
4748 RegisterPlayer(playerid, hashpass);
4749 }
4750 else
4751 {
4752 KickDelay(playerid);
4753 }
4754 }
4755 case DIALOG_LOGIN:
4756 {
4757 new
4758 hashp[129],
4759 string[900]
4760 ;
4761 if(response)
4762 {
4763 WP_Hash(hashp, 129, inputtext);
4764 if(!strcmp(hashp, User[playerid][accountPassword], false))
4765 {
4766 LoginPlayer(playerid);
4767 }
4768 else
4769 {
4770 User[playerid][WarnLog]++;
4771
4772 if(User[playerid][WarnLog] >= ServerInfo[LoginWarn])
4773 {
4774 ShowPlayerDialog(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", "");
4775 KickDelay(playerid);
4776 return 0;
4777 }
4778
4779 format(string, sizeof(string), "Invalid password! - %d out of %d Warning Log Tires.", User[playerid][WarnLog], ServerInfo[LoginWarn]);
4780 SendClientMessage(playerid, COLOR_RED, string);
4781
4782 format(string, sizeof(string), ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\n\n"red"* Wrong password (%d/%d Warnings Log)", User[playerid][WarnLog], ServerInfo[LoginWarn]);
4783
4784 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"Login", string, "Login", "Forget");
4785 }
4786 }
4787 else
4788 {
4789 if(strcmp(User[playerid][accountQuestion], "none", true) == 0)
4790 {
4791 KickDelay(playerid);
4792 }
4793 else
4794 {
4795 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.", User[playerid][accountQuestion]);
4796 ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
4797 }
4798 }
4799 }
4800 case DIALOG_FORGET:
4801 {
4802 if(!response)
4803 {
4804 KickDelay(playerid);
4805 }
4806 else
4807 {
4808 new hashanswer[129];
4809 WP_Hash(hashanswer, 129, inputtext);
4810
4811 if(strcmp(User[playerid][accountAnswer], hashanswer, true) == 0)
4812 {
4813 LoginPlayer(playerid);
4814 SendClientMessage(playerid, -1, "Access granted.");
4815 }
4816 else
4817 {
4818 new string[900];
4819
4820 User[playerid][WarnLog]++;
4821
4822 if(User[playerid][WarnLog] >= ServerInfo[SecureWarn])
4823 {
4824 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server having too much wrong answers!\nTry again, Reconnect (/q then join to the server again.)", "Close", "");
4825 KickDelay(playerid);
4826 return 0;
4827 }
4828
4829 format(string, sizeof(string), "Wrong Answer! - %d out of %d Warning Answer Tires.", User[playerid][WarnLog], ServerInfo[SecureWarn]);
4830 SendClientMessage(playerid, COLOR_RED, string);
4831
4832 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 warning log", User[playerid][accountQuestion], User[playerid][WarnLog], ServerInfo[SecureWarn]);
4833 ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
4834 }
4835 }
4836 }
4837
4838 case DIALOG_COLORS:
4839 {
4840 new string[120], id = GetPVarInt(playerid, "_Colors_");
4841
4842 switch( response )
4843 {
4844 case 0:
4845 {
4846 DeletePVar(playerid, "_Colors_");
4847 SendClientMessage(playerid, -1, "Colour setting has been cancelled.");
4848 }
4849 case 1:
4850 {
4851 switch( listitem )
4852 {
4853 case 0:
4854 {
4855 format(string, sizeof(string), "Administrator %s has set your name color to Black", pName(playerid));
4856 SendClientMessage(id, COLOR_YELLOW, string);
4857 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4858 SendClientMessage(playerid, COLOR_YELLOW, string);
4859 SetPlayerColor(id, COLOR_BLACK);
4860 DeletePVar(playerid, "_Colors_");
4861 }
4862 case 1:
4863 {
4864 format(string, sizeof(string), "Administrator %s has set your name color to White", pName(playerid));
4865 SendClientMessage(id, COLOR_YELLOW, string);
4866 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4867 SendClientMessage(playerid, COLOR_YELLOW, string);
4868 SetPlayerColor(id, COLOR_WHITE);
4869 DeletePVar(playerid, "_Colors_");
4870 }
4871 case 2:
4872 {
4873 format(string, sizeof(string), "Administrator %s has set your name color to Red", pName(playerid));
4874 SendClientMessage(id, COLOR_YELLOW, string);
4875 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4876 SendClientMessage(playerid, COLOR_YELLOW, string);
4877 SetPlayerColor(id, COLOR_RED);
4878 DeletePVar(playerid, "_Colors_");
4879 }
4880 case 3:
4881 {
4882 format(string, sizeof(string), "Administrator %s has set your name color to Orange", pName(playerid));
4883 SendClientMessage(id, COLOR_YELLOW, string);
4884 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4885 SendClientMessage(playerid, COLOR_YELLOW, string);
4886 SetPlayerColor(id, COLOR_ORANGE);
4887 DeletePVar(playerid, "_Colors_");
4888 }
4889 case 4:
4890 {
4891 format(string, sizeof(string), "Administrator %s has set your name color to Yellow", pName(playerid));
4892 SendClientMessage(id, COLOR_YELLOW, string);
4893 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4894 SendClientMessage(playerid, COLOR_YELLOW, string);
4895 SetPlayerColor(id, COLOR_YELLOW);
4896 DeletePVar(playerid, "_Colors_");
4897 }
4898 case 5:
4899 {
4900 format(string, sizeof(string), "Administrator %s has set your name color to Green", pName(playerid));
4901 SendClientMessage(id, COLOR_YELLOW, string);
4902 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4903 SendClientMessage(playerid, COLOR_YELLOW, string);
4904 SetPlayerColor(id, COLOR_GREEN);
4905 DeletePVar(playerid, "_Colors_");
4906 }
4907 case 6:
4908 {
4909 format(string, sizeof(string), "Administrator %s has set your name color to Blue", pName(playerid));
4910 SendClientMessage(id, COLOR_YELLOW, string);
4911 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4912 SendClientMessage(playerid, COLOR_YELLOW, string);
4913 SetPlayerColor(id, COLOR_BLUE);
4914 DeletePVar(playerid, "_Colors_");
4915 }
4916 case 7:
4917 {
4918 format(string, sizeof(string), "Administrator %s has set your name color to Purple", pName(playerid));
4919 SendClientMessage(id, COLOR_YELLOW, string);
4920 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4921 SendClientMessage(playerid, COLOR_YELLOW, string);
4922 SetPlayerColor(id, COLOR_PURPLE);
4923 DeletePVar(playerid, "_Colors_");
4924 }
4925 case 8:
4926 {
4927 format(string, sizeof(string), "Administrator %s has set your name color to Brown", pName(playerid));
4928 SendClientMessage(id, COLOR_YELLOW, string);
4929 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4930 SendClientMessage(playerid, COLOR_YELLOW, string);
4931 SetPlayerColor(id, COLOR_BROWN);
4932 DeletePVar(playerid, "_Colors_");
4933 }
4934 case 9:
4935 {
4936 format(string, sizeof(string), "Administrator %s has set your name color to Pink", pName(playerid));
4937 SendClientMessage(id, COLOR_YELLOW, string);
4938 format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
4939 SendClientMessage(playerid, COLOR_YELLOW, string);
4940 SetPlayerColor(id, COLOR_PINK);
4941 DeletePVar(playerid, "_Colors_");
4942 }
4943 }
4944 }
4945 }
4946 }
4947 }
4948 return 1;
4949}
4950
4951public OnPlayerClickPlayer(playerid, clickedplayerid, source)
4952{
4953 new string[128+50];
4954
4955 format(string, sizeof(string), "You are now viewing '%s' statistics.", pName(clickedplayerid));
4956 SendClientMessage(playerid, COLOR_YELLOW, string);
4957
4958 ShowStatistics(playerid, clickedplayerid);
4959 return 1;
4960}
4961
4962//============================================================================//
4963
4964//Stock and functions starts here.
4965
4966stock pName(playerid)
4967{
4968 new GetName[24];
4969 GetPlayerName(playerid, GetName, 24);
4970 return GetName;
4971}
4972
4973forward bool:IsAdvertisement(text[]);
4974public bool:IsAdvertisement(text[])
4975{
4976 new message[128], build, expression[] = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.+){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", start, end;
4977 strcpy(message, text, sizeof(message));
4978
4979 for(new i = 0, j = strlen(message); i < j; i ++)
4980 {
4981 switch(message[i])
4982 {
4983 case '0'..'9': continue;
4984 case '.': continue;
4985 default:
4986 {
4987 strdel(message, i, i + 1);
4988 strins(message, ".", i);
4989 }
4990 }
4991 }
4992
4993 build = regex_exbuild(expression);
4994 regex_exmatch(message, build);
4995 regex_exsearch(message, build, start, end);
4996
4997 if(start >= 0) return true;
4998 return false;
4999}
5000
5001function:ShowStatistics(playerid, playerid2)
5002{
5003 if(playerid2 == INVALID_PLAYER_ID) return 1; //Do not proceed.
5004
5005 new string[1000], string2[128];
5006
5007 strcat(string, ""white"");
5008 format(string2, sizeof(string2), "-> "purple"User Name: "white"%s (ID: %d)\n", pName(playerid2), playerid2);
5009 strcat(string, string2);
5010 format(string2, sizeof(string2), "-> "purple"User ID: "white"#%d\n", User[playerid2][accountID]);
5011 strcat(string, string2);
5012 format(string2, sizeof(string2), "-> "purple"Register Date: "white"%s\n", User[playerid2][accountDate]);
5013 strcat(string, string2);
5014 format(string2, sizeof(string2), "-> "purple"Playing Hours: "white"%02d:%02d:%02d\n", User[playerid2][accountGame][2], User[playerid2][accountGame][1], User[playerid2][accountGame][0]);
5015 strcat(string, string2);
5016 format(string2, sizeof(string2), "-> "purple"Admin Level: "white"(%d) %s\n", User[playerid2][accountAdmin], GetAdminRank(User[playerid2][accountAdmin]));
5017 strcat(string, string2);
5018 #if VipSystem == true
5019 format(string2, sizeof(string2), "-> "purple"VIP Level: "white"(%d) %s\n", accountVip[playerid2], GetVIPRank(accountVip[playerid2]));
5020 strcat(string, string2);
5021 #endif
5022 format(string2, sizeof(string2), "-> "purple"Score: "white"%d\n", User[playerid2][accountScore]);
5023 strcat(string, string2);
5024 format(string2, sizeof(string2), "-> "purple"Cash: "white"$%d\n", User[playerid2][accountCash]);
5025 strcat(string, string2);
5026 format(string2, sizeof(string2), "-> "purple"Kills: "white"%d\n", User[playerid2][accountKills]);
5027 strcat(string, string2);
5028 format(string2, sizeof(string2), "-> "purple"Deaths: "white"%d\n", User[playerid2][accountDeaths]);
5029 strcat(string, string2);
5030 new Float:ratio = (float(User[playerid2][accountKills])/float(User[playerid2][accountDeaths]));
5031 format(string2, sizeof(string2), "-> "purple"K/D (Ratio): "white"%.3f\n", ratio);
5032 strcat(string, string2);
5033
5034 format(string2, 556, ""lightblue"%s", pName(playerid2));
5035 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
5036 return 1;
5037}
5038
5039function:KickMe(playerid)
5040{
5041 return Kick(playerid);
5042}
5043
5044stock KickDelay(playerid)
5045{
5046 return SetTimerEx("KickMe", 800, false, "d", playerid);
5047}
5048
5049stock loadb()
5050{
5051 new string[128 * 10];
5052
5053 Database = db_open(_DB_);
5054
5055 strcat(string, "CREATE TABLE IF NOT EXISTS `users` ");
5056 strcat(string, "(");
5057 strcat(string, "`userid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` STRING, `IP` STRING, `joindate` STRING, `password` STRING, `admin` INTEGER DEFAULT 0, `vip` INTEGER DEFAULT 0, ");
5058 strcat(string, "`kills` INTEGER DEFAULT 0, `deaths` INTEGER DEFAULT 0, `score` INTEGER DEFAULT 0, `money` INTEGER DEFAULT 0, `warn` INTEGER DEFAULT 0, ");
5059 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, ");
5060 strcat(string, "`hours` INTEGER DEFAULT 0, `minutes` INTEGER DEFAULT 0, `seconds` INTEGER DEFAULT 0, `question` STRING DEFAULT 'none', `answer` STRING DEFAULT 'none'");
5061 strcat(string, ")");
5062 db_query(Database, string);
5063
5064 db_query(Database,
5065 "CREATE TABLE IF NOT EXISTS `bans` (`banid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` STRING, `ip` STRING, `banby` STRING, `banreason` STRING, `banwhen` STRING)");
5066
5067 print("[JakAdmin3] "_DB_" loading...");
5068 return 1;
5069}
5070
5071stock closedb()
5072{
5073 print("[JakAdmin3] "_DB_" closing...");
5074 return db_close(Database);
5075}
5076
5077stock CheckAccount(name[])
5078{
5079 new query[128], DBResult:result, id, field[32];
5080 format(query, sizeof(query), "SELECT `userid` FROM `users` WHERE `username` = '%s'", DB_Escape(name));
5081 result = db_query(Database, query);
5082
5083 if(db_num_rows(result))
5084 {
5085 db_get_field_assoc(result, "userid", field, sizeof(field));
5086 id = strval(field);
5087 }
5088 db_free_result(result);
5089
5090 return id;
5091}
5092
5093stock SaveData(playerid)
5094{
5095 new
5096 Query[128 * 15]
5097 ;
5098
5099 #if VipSystem == true
5100 format(Query, sizeof(Query), "UPDATE `users` SET `IP` = '%s', `admin` = %d, `vip` = %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' WHERE `username` = '%s'",
5101 DB_Escape(User[playerid][accountIP]),
5102 User[playerid][accountAdmin],
5103 accountVip[playerid],
5104 User[playerid][accountKills],
5105 User[playerid][accountDeaths],
5106 User[playerid][accountScore],
5107 User[playerid][accountCash],
5108 User[playerid][accountWarn],
5109 User[playerid][accountMuted],
5110 User[playerid][accountMuteSec],
5111 User[playerid][accountCMuted],
5112 User[playerid][accountCMuteSec],
5113 User[playerid][accountJail],
5114 User[playerid][accountJailSec],
5115 User[playerid][accountGame][2],
5116 User[playerid][accountGame][1],
5117 User[playerid][accountGame][0],
5118 DB_Escape(User[playerid][accountQuestion]),
5119 DB_Escape(User[playerid][accountAnswer]),
5120 DB_Escape(User[playerid][accountName])
5121 );
5122 #else
5123 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' WHERE `username` = '%s'",
5124 DB_Escape(User[playerid][accountIP]),
5125 User[playerid][accountAdmin],
5126 User[playerid][accountKills],
5127 User[playerid][accountDeaths],
5128 User[playerid][accountScore],
5129 User[playerid][accountCash],
5130 User[playerid][accountWarn],
5131 User[playerid][accountMuted],
5132 User[playerid][accountMuteSec],
5133 User[playerid][accountCMuted],
5134 User[playerid][accountCMuteSec],
5135 User[playerid][accountJail],
5136 User[playerid][accountJailSec],
5137 User[playerid][accountGame][2],
5138 User[playerid][accountGame][1],
5139 User[playerid][accountGame][0],
5140 DB_Escape(User[playerid][accountQuestion]),
5141 DB_Escape(User[playerid][accountAnswer]),
5142 DB_Escape(User[playerid][accountName])
5143 );
5144 #endif
5145
5146 db_query(Database, Query);
5147 db_free_result(db_query(Database, Query));
5148 return 1;
5149}
5150
5151stock getIP(playerid)
5152{
5153 new twerp[20];
5154 GetPlayerIp(playerid, twerp, 20);
5155 return twerp;
5156}
5157
5158stock isnumeric(const string[])
5159{
5160 for (new i = 0, j = strlen(string); i < j; i++)
5161 {
5162 if (string[i] > '9' || string[i] < '0') return 0;
5163 }
5164 return 1;
5165}
5166
5167stock GetWeaponIDFromName(WeaponName[])
5168{
5169 if(strfind("molotov", WeaponName, true) != -1) return 18;
5170 for(new i = 0; i <= 46; i++)
5171 {
5172 switch(i)
5173 {
5174 case 0,19,20,21,44,45: continue;
5175 default:
5176 {
5177 new name[32]; GetWeaponName(i,name,32);
5178 if(strfind(name,WeaponName,true) != -1) return i;
5179 }
5180 }
5181 }
5182 return -1;
5183}
5184
5185function:RegisterPlayer(playerid, password[])
5186{
5187 SetPlayerScore(playerid, STARTING_SCORE);
5188 GivePlayerMoney(playerid, STARTING_CASH);
5189
5190 //Time = Hours, Time2 = Minutes, Time3 = Seconds
5191 new time, time2, time3;
5192 gettime(time, time2, time3);
5193 new date, date2, date3;
5194 //Date = Month, Date2 = Day, Date3 = Year
5195 getdate(date3, date, date2);
5196
5197 format(User[playerid][accountDate], 150, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);
5198
5199 format(User[playerid][accountQuestion], 129, "none");
5200 format(User[playerid][accountAnswer], 129, "none");
5201
5202 new
5203 query[128 * 3]
5204 ;
5205
5206 format(query, sizeof(query),
5207 "INSERT INTO `users` (`username`, `IP`, `joindate`, `password`) VALUES ('%s', '%s', '%s', '%s')",\
5208 DB_Escape(pName(playerid)),
5209 DB_Escape(User[playerid][accountIP]),
5210 DB_Escape(User[playerid][accountDate]),
5211 DB_Escape(password),
5212 User[playerid][accountScore],
5213 User[playerid][accountCash],
5214 DB_Escape(User[playerid][accountQuestion]),
5215 DB_Escape(User[playerid][accountAnswer])
5216 );
5217 db_query(Database, query);
5218
5219 User[playerid][accountLogged] = true;
5220
5221 PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
5222
5223 new DBResult: result;
5224 result = db_query(Database, "SELECT last_insert_rowid()");
5225 User[playerid][accountID] = db_get_field_int(result);
5226 db_free_result(result);
5227
5228 SendClientMessage(playerid, COLOR_GREEN, "You have successfully registered from the server.");
5229
5230 ShowPlayerDialog(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");
5231 return 1;
5232}
5233
5234function:LoginPlayer(playerid)
5235{
5236 new
5237 Query[900],
5238 DBResult:Result,
5239 string[128+40]
5240 ;
5241 format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(pName(playerid)));
5242 Result = db_query(Database, Query);
5243 if(db_num_rows(Result))
5244 {
5245 db_get_field_assoc(Result, "userid", Query, 7);
5246 User[playerid][accountID] = strval(Query);
5247
5248 db_get_field_assoc(Result, "score", Query, 20);
5249 User[playerid][accountScore] = strval(Query);
5250 SetPlayerScore(playerid, User[playerid][accountScore]);
5251
5252 db_get_field_assoc(Result, "money", Query, 20);
5253 User[playerid][accountCash] = strval(Query);
5254 GivePlayerMoney(playerid, User[playerid][accountCash]);
5255
5256 db_get_field_assoc(Result, "kills", Query, 20);
5257 User[playerid][accountKills] = strval(Query);
5258
5259 db_get_field_assoc(Result, "deaths", Query, 20);
5260 User[playerid][accountDeaths] = strval(Query);
5261
5262 db_get_field_assoc(Result, "admin", Query, 7);
5263 User[playerid][accountAdmin] = strval(Query);
5264
5265 db_get_field_assoc(Result, "joindate", Query, 150);
5266 format(User[playerid][accountDate], 150, "%s", Query);
5267
5268 db_get_field_assoc(Result, "warn", Query, 5);
5269 User[playerid][accountWarn] = strval(Query);
5270
5271 db_get_field_assoc(Result, "mute", Query, 5);
5272 User[playerid][accountMuted] = strval(Query);
5273
5274 db_get_field_assoc(Result, "mutesec", Query, 8);
5275 User[playerid][accountMuteSec] = strval(Query);
5276
5277 db_get_field_assoc(Result, "cmute", Query, 6);
5278 User[playerid][accountCMuted] = strval(Query);
5279
5280 db_get_field_assoc(Result, "cmutesec", Query, 9);
5281 User[playerid][accountCMuteSec] = strval(Query);
5282
5283 db_get_field_assoc(Result, "jail", Query, 5);
5284 User[playerid][accountJail] = strval(Query);
5285
5286 db_get_field_assoc(Result, "jailsec", Query, 8);
5287 User[playerid][accountJailSec] = strval(Query);
5288
5289 db_get_field_assoc(Result, "hours", Query, 6);
5290 User[playerid][accountGame][2] = strval(Query);
5291
5292 db_get_field_assoc(Result, "minutes", Query, 8);
5293 User[playerid][accountGame][1] = strval(Query);
5294
5295 db_get_field_assoc(Result, "seconds", Query, 8);
5296 User[playerid][accountGame][0] = strval(Query);
5297
5298 #if VipSystem == true
5299 db_get_field_assoc(Result, "vip", Query, 2);
5300 accountVip[playerid] = strval(Query);
5301 #endif
5302
5303 User[playerid][accountLogged] = true;
5304
5305 if(User[playerid][accountMuted] == 1)
5306 {
5307 format(string, 200, "PUNISHMENT: You have been muted from using the chat for %d seconds, You are muted the last time you logged out.", User[playerid][accountMuteSec]);
5308 SendClientMessage(playerid, COLOR_RED, string);
5309 }
5310 if(User[playerid][accountCMuted] == 1)
5311 {
5312 format(string, 200, "PUNISHMENT: You have been muted from using the commands for %d seconds, You are muted the last time you logged out.", User[playerid][accountCMuteSec]);
5313 SendClientMessage(playerid, COLOR_RED, string);
5314 }
5315
5316 SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You have successfully logged in to the server.");
5317 if(User[playerid][accountAdmin] >= 1)
5318 {
5319 format(string, sizeof(string), "* You have logged in the server as %s.", GetAdminRank(User[playerid][accountAdmin]));
5320 SendClientMessage(playerid, -1, string);
5321 }
5322 #if VipSystem == true
5323 if(accountVip[playerid] >= 1)
5324 {
5325 format(string, sizeof(string), "* You have logged in as (%s)", GetVIPRank(accountVip[playerid]));
5326 SendClientMessage(playerid, COLOR_GREEN, string);
5327 }
5328 #endif
5329
5330 PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
5331 }
5332 db_free_result(Result);
5333 return 1;
5334}
5335
5336function:IsValidPassword( const password[ ] )
5337{
5338 for( new i = 0; password[ i ] != EOS; ++i )
5339 {
5340 switch( password[ i ] )
5341 {
5342 case '0'..'9', 'A'..'Z', 'a'..'z': continue;
5343 default: return 0;
5344 }
5345 }
5346 return 1;
5347}
5348
5349stock DB_Escape(text[])
5350{
5351 new
5352 ret[80* 2],
5353 ch,
5354 i,
5355 j;
5356 while ((ch = text[i++]) && j < sizeof (ret))
5357 {
5358 if (ch == '\'')
5359 {
5360 if (j < sizeof (ret) - 2)
5361 {
5362 ret[j++] = '\'';
5363 ret[j++] = '\'';
5364 }
5365 }
5366 else if (j < sizeof (ret))
5367 {
5368 ret[j++] = ch;
5369 }
5370 else
5371 {
5372 j++;
5373 }
5374 }
5375 ret[sizeof (ret) - 1] = '\0';
5376 return ret;
5377}
5378
5379stock CheckBan(ip[])
5380{
5381 new string[20];
5382 new File: file = fopen("JakAdmin3/ban.ini", io_read);
5383 while(fread(file, string))
5384 {
5385 if (strcmp(ip, string, true, strlen(ip)) == 0)
5386 {
5387 fclose(file);
5388 return 1;
5389 }
5390 }
5391 fclose(file);
5392 return 0;
5393}
5394
5395stock AddBan(ip[])
5396{
5397 if (!CheckBan(ip))
5398 {
5399 new File: file = fopen("JakAdmin3/ban.ini", io_append);
5400 new string[300];
5401 format(string, sizeof(string), "\r\n%s", ip);
5402 fwrite(file, string);
5403 fclose(file);
5404 return 1;
5405 }
5406 return 0;
5407}
5408
5409stock RemoveBan(ip[])
5410{
5411 if (CheckBan(ip))
5412 {
5413 new string[20];
5414 new File: file = fopen("JakAdmin3/ban.ini", io_read);
5415 dini_Create("JakAdmin3/tempBan.ini");
5416 new File: file2 = fopen("JakAdmin3/tempBan.ini", io_append);
5417 while(fread(file, string))
5418 {
5419 if (strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\r\n", string) != 0)
5420 {
5421 fwrite(file2, string);
5422 }
5423 }
5424 fclose(file);
5425 fclose(file2);
5426 file = fopen("JakAdmin3/ban.ini", io_write);
5427 file2 = fopen("JakAdmin3/tempBan.ini", io_read);
5428 while(fread(file2, string))
5429 {
5430 fwrite(file, string);
5431 }
5432 fclose(file);
5433 fclose(file2);
5434 fremove("JakAdmin3/tempBan.ini");
5435 return 1;
5436 }
5437 return 0;
5438}
5439
5440stock ShowBan(playerid, banid = -1, admin[] = "JakAdmin3", reason[] = "69 Sex", when[] = "01/01/1970 00:00:00")
5441{
5442 new string[256], string2[1500];
5443
5444 for(new i=0; i<100; i++)
5445 {
5446 SendClientMessage(playerid, -1, " ");
5447 }
5448
5449 format(string, 256, "You're banned from server by %s for the following reasons:", admin);
5450 SendClientMessage(playerid, COLOR_RED, string);
5451 format(string, 256, "(( %s ))", reason);
5452 SendClientMessage(playerid, -1, string);
5453
5454 strcat(string2, ""grey"");
5455 strcat(string2, "You are banned from this server, Statistics of your ban:\n\n");
5456 format(string, 256, ""white"Ban ID: "red"#%d\n", banid);
5457 strcat(string2, string);
5458 format(string, 256, ""white"Name: "red"%s\n", pName(playerid));
5459 strcat(string2, string);
5460 format(string, 256, ""white"Banned By: "red"%s\n", admin);
5461 strcat(string2, string);
5462 format(string, 256, ""white"Reason: "red"%s\n", reason);
5463 strcat(string2, string);
5464 format(string, 256, ""white"IP: "red"%s\n", User[playerid][accountIP]);
5465 strcat(string2, string);
5466 format(string, 256, ""white"Banned since: "red"%s\n\n", when);
5467 strcat(string2, string);
5468 strcat(string2, ""grey"");
5469 strcat(string2, "If you think this is a bugged, false ban or the admin abused his/her power, Please place a ban appeal on forums.\n");
5470 strcat(string2, "Make sure to take a picture of this by pressing F8, Do not lie on your appeal.");
5471
5472 ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"You are banned from this server.", string2, "Close", "");
5473 return 1;
5474}
5475
5476stock BanAccountEx(name[], ip[], admin[] = "Anticheat", reason[] = "None")
5477{
5478 new
5479 Query[500],
5480 DBResult:result,
5481 ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[128]
5482 ;
5483
5484 gettime(ban_hr, ban_min, ban_sec);
5485 getdate(ban_years, ban_month, ban_days);
5486
5487 format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
5488
5489 format(Query, 500, "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`) VALUES ('%s', '%s', '%s', '%s', '%s')", DB_Escape(name), DB_Escape(ip), DB_Escape(admin), DB_Escape(reason), DB_Escape(when));
5490 result = db_query(Database, Query);
5491
5492 db_free_result(result);
5493 return 1;
5494}
5495
5496stock BanAccount(playerid, admin[] = "Anticheat", reason[] = "None")
5497{
5498 new
5499 Query[500],
5500 DBResult:result,
5501 ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[128]
5502 ;
5503
5504 gettime(ban_hr, ban_min, ban_sec);
5505 getdate(ban_years, ban_month, ban_days);
5506
5507 format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
5508
5509 AddBan(User[playerid][accountIP]);
5510
5511 format(Query, 500, "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`) VALUES ('%s', '%s', '%s', '%s', '%s')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), DB_Escape(admin), DB_Escape(reason), DB_Escape(when));
5512 db_query(Database, Query);
5513
5514 result = db_query(Database, "SELECT last_insert_rowid()");
5515 SetPVarInt(playerid, "ban_id", db_get_field_int(result));
5516 db_free_result(result);
5517 return 1;
5518}
5519
5520function:IsValidWeapon(weaponid)
5521{
5522 if (weaponid > 0 && weaponid < 19 || weaponid > 21 && weaponid < 47) return 1;
5523 return 0;
5524}
5525
5526function:SaveLog(filename[], text[])
5527{
5528 if(!ServerInfo[SaveLogs])
5529 return 0;
5530
5531 new string[256];
5532
5533 if(!fexist(_LOG_))
5534 {
5535 printf("[JakAdmin3] Unable to overwrite '%s' at the '%s', '%s' missing.", filename, _LOG_, _LOG_);
5536 print("No logs has been saved to your server database.");
5537
5538 format(string, sizeof string, "JakAdmin3 has attempted to overwrite '%s' at the '%s' which is missing.", filename, _LOG_);
5539 SendAdmin(COLOR_RED, string);
5540 SendAdmin(-1, "No logs has been saved to the server database, Check the console for further solution.");
5541 return 0;
5542 }
5543
5544 new File:file,
5545 filepath[128+40]
5546 ;
5547
5548 new year, month, day;
5549 new hour, minute, second;
5550
5551 getdate(year, month, day);
5552 gettime(hour, minute, second);
5553 format(filepath, sizeof(filepath), ""_LOG_"%s", filename);
5554 file = fopen(filepath, io_append);
5555 format(string, sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n", month, day, year, hour, minute, second, text);
5556 fwrite(file, string);
5557 fclose(file);
5558 return 1;
5559}
5560
5561stock VehicleOccupied(vehicleid)
5562{
5563 for(new i = 0; i < MAX_PLAYERS; i++)
5564 {
5565 if(IsPlayerInVehicle(i, vehicleid)) return 1;
5566 }
5567 return 0;
5568}
5569
5570stock DataExist(name[])
5571{
5572 new Buffer[180],
5573 Entry,
5574 DBResult:Result
5575 ;
5576
5577 format(Buffer, sizeof(Buffer), "SELECT `userid` FROM `users` WHERE `username` = '%s'", name);
5578 Result = db_query(Database, Buffer);
5579
5580 if(Result)
5581 {
5582 if(db_num_rows(Result))
5583 {
5584 Entry = 1;
5585 db_free_result(Result);
5586 }
5587 else Entry = 0;
5588 }
5589 return Entry;
5590}
5591
5592stock SendAdmin(color, string[])
5593{
5594 foreach(new i : Player)
5595 {
5596 if(User[i][accountAdmin] >= 1)
5597 {
5598 SendClientMessage(i, color, string);
5599 }
5600 }
5601}
5602
5603stock StartSpectate(playerid, specplayerid)
5604{
5605 foreach(new x : Player)
5606 {
5607 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
5608 {
5609 AdvanceSpectate(x);
5610 }
5611 }
5612 SetPlayerInterior(playerid, GetPlayerInterior(specplayerid));
5613 TogglePlayerSpectating(playerid, 1);
5614
5615 if(IsPlayerInAnyVehicle(specplayerid))
5616 {
5617 PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
5618 User[playerid][SpecID] = specplayerid;
5619 User[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
5620 }
5621 else
5622 {
5623 PlayerSpectatePlayer(playerid, specplayerid);
5624 User[playerid][SpecID] = specplayerid;
5625 User[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
5626 }
5627 return 1;
5628}
5629
5630stock StopSpectate(playerid)
5631{
5632 TogglePlayerSpectating(playerid, 0);
5633 User[playerid][SpecID] = INVALID_PLAYER_ID;
5634 User[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
5635 GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
5636 return 1;
5637}
5638
5639stock AdvanceSpectate(playerid)
5640{
5641 if(Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; }
5642 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
5643 {
5644 for(new x=User[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
5645 {
5646 if(x == MAX_PLAYERS) x = 0;
5647 if(IsPlayerConnected(x) && x != playerid)
5648 {
5649 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
5650 {
5651 continue;
5652 }
5653 else
5654 {
5655 StartSpectate(playerid, x);
5656 break;
5657 }
5658 }
5659 }
5660 }
5661 return 1;
5662}
5663
5664stock ReverseSpectate(playerid)
5665{
5666 if(Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; }
5667 if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
5668 {
5669 for(new x=User[playerid][SpecID]-1; x>=0; x--)
5670 {
5671 if(x == 0) x = MAX_PLAYERS;
5672 if(IsPlayerConnected(x) && x != playerid)
5673 {
5674 if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
5675 {
5676 continue;
5677 }
5678 else
5679 {
5680 StartSpectate(playerid, x);
5681 break;
5682 }
5683 }
5684 }
5685 }
5686 return 1;
5687}
5688
5689stock GetVehicleModelIDFromName(vname[])
5690{
5691 for(new i = 0; i < 211; i++)
5692 {
5693 if ( strfind(VehicleNames[i], vname, true) != -1 )
5694 return i + 400;
5695 }
5696 return -1;
5697}
5698
5699function:EraseVeh(vehicleid)
5700{
5701 foreach(new i : Player)
5702 {
5703 new Float:X, Float:Y, Float:Z;
5704 if(IsPlayerInVehicle(i, vehicleid))
5705 {
5706 RemovePlayerFromVehicle(i);
5707 GetPlayerPos(i, X, Y, Z);
5708 SetPlayerPos(i, X, Y+3, Z);
5709 }
5710 SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
5711 }
5712 SetTimerEx("VehRes", 1500, 0, "i", vehicleid);
5713}
5714
5715function:DelVehicle(vehicleid)
5716{
5717 foreach(new players : Player)
5718 {
5719 new Float:X, Float:Y, Float:Z;
5720 if(IsPlayerInVehicle(players, vehicleid))
5721 {
5722 GetPlayerPos(players, X, Y, Z);
5723 SetPlayerPos(players, X, Y, Z+2);
5724 SetVehicleToRespawn(vehicleid);
5725 }
5726 SetVehicleParamsForPlayer(vehicleid, players, 0, 1);
5727 }
5728 SetTimerEx("VehRes", 3000, 0, "d", vehicleid);
5729 return 1;
5730}
5731
5732stock Config()
5733{
5734 print("\n");
5735
5736 new
5737 dialog,
5738 rconpass
5739 ;
5740
5741 #if REGISTER_DIALOG == true
5742 dialog = 1;
5743 #endif
5744
5745 #if RconProtect == true
5746 rconpass = 1;
5747 #endif
5748
5749 #if VipSystem == true
5750 vipsys = 1;
5751 #endif
5752
5753 print("\n***** JakAdmin 3.4.1 Configuration *****\n\n");
5754 print("-> Config.Ini Settings;");
5755 printf("Saving Logs @ JakAdmin3/Logs; %s", (ServerInfo[SaveLogs]) ? ("Yes") : ("No"));
5756 printf("Auto-Login On-Connect; %s", (ServerInfo[AutoLogin]) ? ("Yes") : ("No"));
5757 printf("Read Player Commands; %s", (ServerInfo[ReadCmds]) ? ("Yes") : ("No"));
5758 printf("Maximum Login Tries; %d", ServerInfo[LoginWarn]);
5759 printf("Maximum Security Question Tries; %d", ServerInfo[SecureWarn]);
5760 printf("Max Ping Kicker; %s (Maximum Warnings; %d)", (ServerInfo[SaveLogs]) ? ("On") : ("Off"), ServerInfo[MaxPingWarn]);
5761 printf("Disable Player's Swear; %s", (ServerInfo[AntiSwear]) ? ("Yes") : ("No"));
5762 printf("Kick Player with Forbid Name; %s", (ServerInfo[AntiName]) ? ("Yes") : ("No"));
5763 printf("Prevent Server Advertising; %s", (ServerInfo[AntiAd]) ? ("Yes") : ("No"));
5764 printf("Prevent Player from Spamming; %s", (ServerInfo[AntiSpam]) ? ("Yes") : ("No"));
5765 print("\n-> Script Settings;");
5766 printf("Use Dialog on Register/Login; %s", (dialog == 1) ? ("Yes") : ("No"));
5767 printf("Use the built-in RCON security; %s", (rconpass == 1) ? ("Yes") : ("No"));
5768 printf("Use the built-in VIP System; %s", (vipsys == 1) ? ("Yes") : ("No"));
5769 print("\n-> Forbidden Words && Names;");
5770 printf("%d forbidden names loaded", BadNameCount);
5771 printf("%d forbidden words loaded", ForbiddenWordCount);
5772 print("\n-> Ranks;");
5773 #if VipSystem == true
5774 printf("VIP Rank #1: %s", ServerInfo[VipRank1]);
5775 printf("VIP Rank #2: %s", ServerInfo[VipRank2]);
5776 printf("VIP Rank #3: %s", ServerInfo[VipRank3]);
5777 #endif
5778 printf("Admin Rank #1: %s", ServerInfo[AdminRank1]);
5779 printf("Admin Rank #2: %s", ServerInfo[AdminRank2]);
5780 printf("Admin Rank #3: %s", ServerInfo[AdminRank3]);
5781 printf("Admin Rank #4: %s", ServerInfo[AdminRank4]);
5782 printf("Admin Rank #5: %s", ServerInfo[AdminRank5]);
5783 print("\n\n***** JakAdmin 3.4.1 Configuration *****\n");
5784 return 1;
5785}
5786
5787function:VehRes(vehicleid)
5788{
5789 DestroyVehicle(vehicleid);
5790}
5791
5792stock TimeStamp()
5793{
5794 new time = GetTickCount() / 1000;
5795 return time;
5796}
5797
5798function:checkfolderEx()
5799{
5800 if(!fexist("JakAdmin3/"))
5801 {
5802 return 0;
5803 }
5804 if(!fexist("JakAdmin3/Logs/"))
5805 {
5806 return 0;
5807 }
5808 return 1;
5809}
5810
5811function:checkfolder()
5812{
5813 if(!fexist("JakAdmin3/"))
5814 {
5815 print("\n[JakAdmin3]: JakAdmin3 folder doesn't exist in scriptfiles, JakAdmin3 won't start.");
5816 print("Solution: Create the folder JakAdmin3 on the scriptfiles.");
5817 print("Continusly using the script with the missing file will not save the target script objective.\n");
5818 return 0;
5819 }
5820 if(!fexist("JakAdmin3/Logs/"))
5821 {
5822 print("\n[JakAdmin3]: Logs folder doesn't exist in JakAdmin3 folder, JakAdmin3 won't start.");
5823 print("Solution: Create the folder Logs on the JakAdmin3 folder.");
5824 print("Continusly using the script with the missing file will not save the target script objective.\n");
5825 return 0;
5826 }
5827 ////////////////////////////////////////////////////////////////////////////
5828
5829 new config[92];
5830 format(config, sizeof(config), "JakAdmin3/config.ini");
5831
5832 if(!fexist("JakAdmin3/config.ini"))
5833 {
5834 print("\n[JakAdmin3]: config.ini doesn't exist, JakAdmin3 has created it for you.");
5835 print("[JakAdmin3]: config.ini has the default values setted on it, modify it your own.\n");
5836
5837 dini_Create("JakAdmin3/config.ini");
5838 /////
5839 dini_IntSet(config, "SaveLog", 1);
5840 ServerInfo[SaveLogs] = 1;
5841 /////
5842 dini_IntSet(config, "LoginWarn", 3);
5843 ServerInfo[LoginWarn] = 3;
5844 /////
5845 dini_IntSet(config, "SecureWarn", 3);
5846 ServerInfo[SecureWarn] = 3;
5847 /////
5848 dini_IntSet(config, "AutoLogin", 0);
5849 ServerInfo[AutoLogin] = 0;
5850 /////
5851 dini_IntSet(config, "ReadCmds", 1);
5852 ServerInfo[ReadCmds] = 1;
5853 /////
5854 dini_IntSet(config, "MaxPing", 0);
5855 ServerInfo[MaxPing] = 0;
5856 /////
5857 dini_IntSet(config, "MaxPingWarn", 3);
5858 ServerInfo[MaxPingWarn] = 3;
5859 /////
5860 dini_IntSet(config, "AntiSwear", 1);
5861 ServerInfo[AntiSwear] = 1;
5862 /////
5863 dini_IntSet(config, "AntiName", 1);
5864 ServerInfo[AntiName] = 1;
5865 /////
5866 dini_IntSet(config, "AntiAd", 1);
5867 ServerInfo[AntiAd] = 1;
5868 /////
5869 dini_IntSet(config, "AntiSpam", 0);
5870 ServerInfo[AntiSpam] = 0;
5871 /////
5872 #if VipSystem == true
5873 format(ServerInfo[VipRank1], 256, "Silver VIP");
5874 dini_Set(config, "VipRank1", ServerInfo[VipRank1]);
5875 format(ServerInfo[VipRank2], 256, "Gold VIP");
5876 dini_Set(config, "VipRank2", ServerInfo[VipRank2]);
5877 format(ServerInfo[VipRank3], 256, "Premium VIP");
5878 dini_Set(config, "VipRank3", ServerInfo[VipRank3]);
5879 #endif
5880 /////
5881 format(ServerInfo[AdminRank1], 256, "Moderator");
5882 dini_Set(config, "AdminRank1", ServerInfo[AdminRank1]);
5883 format(ServerInfo[AdminRank2], 256, "Admin");
5884 dini_Set(config, "AdminRank2", ServerInfo[AdminRank2]);
5885 format(ServerInfo[AdminRank3], 256, "Head Admin");
5886 dini_Set(config, "AdminRank3", ServerInfo[AdminRank3]);
5887 format(ServerInfo[AdminRank4], 256, "Lead Admin");
5888 dini_Set(config, "AdminRank4", ServerInfo[AdminRank4]);
5889 format(ServerInfo[AdminRank5], 256, "Owner");
5890 dini_Set(config, "AdminRank5", ServerInfo[AdminRank5]);
5891 }
5892 else if(fexist("JakAdmin3/config.ini"))
5893 {
5894 ServerInfo[SaveLogs] = dini_Int(config, "SaveLog");
5895 ServerInfo[LoginWarn] = dini_Int(config, "LoginWarn");
5896 ServerInfo[SecureWarn] = dini_Int(config, "SecureWarn");
5897 ServerInfo[AutoLogin] = dini_Int(config, "AutoLogin");
5898 ServerInfo[ReadCmds] = dini_Int(config, "ReadCmds");
5899 ServerInfo[MaxPing] = dini_Int(config, "MaxPing");
5900 ServerInfo[MaxPingWarn] = dini_Int(config, "MaxPingWarn");
5901 ServerInfo[AntiSwear] = dini_Int(config, "AntiSwear");
5902 ServerInfo[AntiName] = dini_Int(config, "AntiName");
5903 ServerInfo[AntiAd] = dini_Int(config, "AntiAd");
5904 ServerInfo[AntiSpam] = dini_Int(config, "AntiSpam");
5905 /////
5906 #if VipSystem == true
5907 strmid(ServerInfo[VipRank1], dini_Get(config, "VipRank1"), false, strlen(dini_Get(config, "VipRank1")), 128);
5908 strmid(ServerInfo[VipRank2], dini_Get(config, "VipRank2"), false, strlen(dini_Get(config, "VipRank2")), 128);
5909 strmid(ServerInfo[VipRank3], dini_Get(config, "VipRank3"), false, strlen(dini_Get(config, "VipRank3")), 128);
5910 #endif
5911 /////
5912 strmid(ServerInfo[AdminRank1], dini_Get(config, "AdminRank1"), false, strlen(dini_Get(config, "AdminRank1")), 128);
5913 strmid(ServerInfo[AdminRank2], dini_Get(config, "AdminRank2"), false, strlen(dini_Get(config, "AdminRank2")), 128);
5914 strmid(ServerInfo[AdminRank3], dini_Get(config, "AdminRank3"), false, strlen(dini_Get(config, "AdminRank3")), 128);
5915 strmid(ServerInfo[AdminRank4], dini_Get(config, "AdminRank4"), false, strlen(dini_Get(config, "AdminRank4")), 128);
5916 strmid(ServerInfo[AdminRank5], dini_Get(config, "AdminRank5"), false, strlen(dini_Get(config, "AdminRank5")), 128);
5917 }
5918
5919 ////////////////////////////////////////////////////////////////////////////
5920
5921 new File:file2, string[100];
5922
5923 if(fexist("JakAdmin3/ForbiddenNames.cfg"))
5924 {
5925 if((file2 = fopen("JakAdmin3/ForbiddenNames.cfg",io_read)))
5926 {
5927 while(fread(file2,string))
5928 {
5929 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
5930 BadNames[BadNameCount] = string;
5931 BadNameCount++;
5932 }
5933 fclose(file2);
5934 }
5935 }
5936 else
5937 {
5938 print("\n[JakAdmin3]: ForbiddenNames.cfg doesn't exist, JakAdmin3 has created it for you.\n");
5939 dini_Create("JakAdmin3/ForbiddenNames.cfg");
5940 }
5941
5942 ////////////////////////////////////////////////////////////////////////////
5943
5944 if(fexist("JakAdmin3/ForbiddenWords.cfg"))
5945 {
5946 if((file2 = fopen("JakAdmin3/ForbiddenWords.cfg",io_read)))
5947 {
5948 while(fread(file2,string))
5949 {
5950 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
5951 ForbiddenWords[ForbiddenWordCount] = string;
5952 ForbiddenWordCount++;
5953 }
5954 fclose(file2);
5955 }
5956 }
5957 else
5958 {
5959 print("\n[JakAdmin3]: ForbiddenWords.cfg doesn't exist, JakAdmin3 has created it for you.\n");
5960 dini_Create("JakAdmin3/ForbiddenWords.cfg");
5961 }
5962 return 1;
5963}
5964
5965function:ShowRanks(playerid)
5966{
5967 new string[128], combine[128 * 10];
5968
5969 strcat(combine, "Rank\tName\n");
5970
5971 format(string, sizeof(string), "Admin Rank #1\t"green"%s\n", ServerInfo[AdminRank1]);
5972 strcat(combine, string);
5973 format(string, sizeof(string), "Admin Rank #2\t"red"%s\n", ServerInfo[AdminRank2]);
5974 strcat(combine, string);
5975 format(string, sizeof(string), "Admin Rank #3\t"green"%s\n", ServerInfo[AdminRank3]);
5976 strcat(combine, string);
5977 format(string, sizeof(string), "Admin Rank #4\t"red"%s\n", ServerInfo[AdminRank4]);
5978 strcat(combine, string);
5979 format(string, sizeof(string), "Admin Rank #5\t"green"%s\n", ServerInfo[AdminRank5]);
5980 strcat(combine, string);
5981 #if VipSystem == true
5982 format(string, sizeof(string), "VIP Rank #1\t"orange"%s\n", ServerInfo[VipRank1]);
5983 strcat(combine, string);
5984 format(string, sizeof(string), "VIP Rank #2\t"green"%s\n", ServerInfo[VipRank2]);
5985 strcat(combine, string);
5986 format(string, sizeof(string), "VIP Rank #3\t"orange"%s\n", ServerInfo[VipRank3]);
5987 strcat(combine, string);
5988 #endif
5989
5990 ShowPlayerDialog(playerid, DIALOG_RANKS, DIALOG_STYLE_TABLIST_HEADERS, "Ranks Configuration", combine, "Edit", "Back");
5991 return 1;
5992}
5993
5994function:ShowSettings(playerid)
5995{
5996 new string[128], combine[128 * 10];
5997
5998 strcat(combine, "Name\tStatus\tInfo\n");
5999
6000 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""));
6001 strcat(combine, string);
6002 format(string, sizeof(string), "Maximum Login Tries\t"grey"%d\tMaximum Login Warning before they get kicked\n", ServerInfo[LoginWarn]);
6003 strcat(combine, string);
6004 format(string, sizeof(string), "Maximum Security Tries\t"grey"%d\tMaximum Security Question Warning before they get kicked\n", ServerInfo[SecureWarn]);
6005 strcat(combine, string);
6006 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""));
6007 strcat(combine, string);
6008 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""));
6009 strcat(combine, string);
6010 format(string, sizeof(string), "Ping Kicker\t"grey"%d"white"\tKicks the player when reached the maximum ping (0 to disable)\n", ServerInfo[MaxPing]);
6011 strcat(combine, string);
6012 format(string, sizeof(string), "Maximum Ping Warning\t"grey"%d"white"\tMaximum Ping Warning before they get kicked\n", ServerInfo[MaxPingWarn]);
6013 strcat(combine, string);
6014 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""));
6015 strcat(combine, string);
6016 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""));
6017 strcat(combine, string);
6018 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""));
6019 strcat(combine, string);
6020 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""));
6021 strcat(combine, string);
6022
6023 #if VipSystem == true
6024 strcat(combine, "Ranks\t"grey"8"white"\tEdit the Admin & VIP Ranks here!");
6025 #else
6026 strcat(combine, "Ranks\t"grey"5"white"\tEdit the Admin Ranks here!");
6027 #endif
6028
6029 ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_TABLIST_HEADERS, "JakAdmin Configuration", combine, "Edit", "Cancel");
6030 return 1;
6031}
6032
6033stock GetAdminRank(level)
6034{
6035 new name[64];
6036
6037 switch(level)
6038 {
6039 case 1: format(name, 64, ServerInfo[AdminRank1]);
6040 case 2: format(name, 64, ServerInfo[AdminRank2]);
6041 case 3: format(name, 64, ServerInfo[AdminRank3]);
6042 case 4: format(name, 64, ServerInfo[AdminRank4]);
6043 case 5: format(name, 64, ServerInfo[AdminRank5]);
6044 default: format(name, 64, "Player");
6045 }
6046 return name;
6047}
6048
6049stock GetVIPRank(level)
6050{
6051 new name[64];
6052
6053 switch(level)
6054 {
6055 case 1: format(name, 64, ServerInfo[VipRank1]);
6056 case 2: format(name, 64, ServerInfo[VipRank2]);
6057 case 3: format(name, 64, ServerInfo[VipRank3]);
6058 default: format(name, 64, "Player");
6059 }
6060 return name;
6061}
6062
6063function:SaveConfig()
6064{
6065 new config[92];
6066 format(config, sizeof(config), "JakAdmin3/config.ini");
6067
6068 dini_IntSet(config, "SaveLog", ServerInfo[SaveLogs]);
6069 dini_IntSet(config, "LoginWarn", ServerInfo[LoginWarn]);
6070 dini_IntSet(config, "SecureWarn", ServerInfo[SecureWarn]);
6071 dini_IntSet(config, "AutoLogin", ServerInfo[AutoLogin]);
6072 dini_IntSet(config, "ReadCmds", ServerInfo[ReadCmds]);
6073 dini_IntSet(config, "MaxPing", ServerInfo[MaxPing]);
6074 dini_IntSet(config, "MaxPingWarn", ServerInfo[MaxPingWarn]);
6075 dini_IntSet(config, "AntiSwear", ServerInfo[AntiSwear]);
6076 dini_IntSet(config, "AntiName", ServerInfo[AntiName]);
6077 dini_IntSet(config, "AntiAd", ServerInfo[AntiAd]);
6078 dini_IntSet(config, "AntiSpam", ServerInfo[AntiSpam]);
6079 #if VipSystem == true
6080 dini_Set(config, "VipRank1", ServerInfo[VipRank1]);
6081 dini_Set(config, "VipRank2", ServerInfo[VipRank2]);
6082 dini_Set(config, "VipRank3", ServerInfo[VipRank3]);
6083 #endif
6084 dini_Set(config, "AdminRank1", ServerInfo[AdminRank1]);
6085 dini_Set(config, "AdminRank2", ServerInfo[AdminRank2]);
6086 dini_Set(config, "AdminRank3", ServerInfo[AdminRank3]);
6087 dini_Set(config, "AdminRank4", ServerInfo[AdminRank4]);
6088 dini_Set(config, "AdminRank5", ServerInfo[AdminRank5]);
6089 return 1;
6090}
6091
6092function:UpdateForbidden()
6093{
6094 new File:file2, string[100];
6095
6096 if((file2 = fopen("JakAdmin3/ForbiddenNames.cfg",io_read)))
6097 {
6098 while(fread(file2,string))
6099 {
6100 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
6101 BadNames[BadNameCount] = string;
6102 BadNameCount++;
6103 }
6104 fclose(file2);
6105 printf("\n-> %d forbidden names loaded from JakAdmin3", BadNameCount);
6106 }
6107
6108 if((file2 = fopen("JakAdmin3/ForbiddenWords.cfg",io_read)))
6109 {
6110 while(fread(file2,string))
6111 {
6112 for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
6113 ForbiddenWords[ForbiddenWordCount] = string;
6114 ForbiddenWordCount++;
6115 }
6116 fclose(file2);
6117 printf("-> %d forbidden words loaded from JakAdmin3", ForbiddenWordCount);
6118 }
6119 return 1;
6120}
6121
6122function:PosAfterSpec(playerid)
6123{
6124 SetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
6125 SetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
6126 SetPlayerInterior(playerid, SpecInt[playerid][0]);
6127 SetPlayerVirtualWorld(playerid, SpecInt[playerid][1]);
6128}
6129
6130/////////////////////////////// INCLUDE SUPPORT ////////////////////////////////
6131
6132function:vip_check()
6133{
6134 // Checks if the VIP system is disabled or enabled
6135 return vipsys;
6136}
6137
6138#if VipSystem == true
6139 function:check_vip(playerid)
6140 {
6141 // Checks the VIP level of the player
6142 return accountVip[playerid];
6143 }
6144
6145 function:set_vip(playerid, level)
6146 {
6147 // Sets the VIP level of the player
6148 accountVip[playerid] = level;
6149 return 1;
6150 }
6151#endif
6152
6153function:save_player(playerid)
6154{
6155 return SaveData(playerid);
6156}
6157
6158function:check_admin(playerid)
6159{
6160 // Checks the admin level of the player
6161 return User[playerid][accountAdmin];
6162}
6163
6164function:set_admin(playerid, level)
6165{
6166 // Sets the admin level of the player
6167 User[playerid][accountAdmin] = level;
6168 return 1;
6169}
6170
6171function:check_login(playerid)
6172{
6173 // Checks if the player is logged in or not
6174 return User[playerid][accountLogged];
6175}
6176
6177function:set_log(playerid, toggle)
6178{
6179 // Sets the accountLogged to toggle
6180 if(toggle == 0)
6181 {
6182 User[playerid][accountLogged] = 0;
6183 }
6184 else if(toggle >= 1)
6185 {
6186 User[playerid][accountLogged] = 1;
6187 }
6188 return 1;
6189}
6190
6191function:check_mute(playerid)
6192{
6193 // Check if the player is muted or not
6194 return User[playerid][accountMuted];
6195}
6196
6197function:check_mutesec(playerid)
6198{
6199 // Check the player's mute seconds if there is any
6200 return User[playerid][accountMuteSec];
6201}
6202
6203function:check_cmute(playerid)
6204{
6205 // Check if the player is muted or not
6206 return User[playerid][accountCMuted];
6207}
6208
6209function:check_cmutesec(playerid)
6210{
6211 // Check the player's mute seconds if there is any
6212 return User[playerid][accountCMuteSec];
6213}
6214
6215function:set_mute(playerid, toggle)
6216{
6217 // Set the player's mute status
6218 User[playerid][accountMuted] = toggle;
6219 return 1;
6220}
6221
6222function:set_mutesec(playerid, sec)
6223{
6224 // Set the player's mute seconds
6225 User[playerid][accountMuteSec] = sec;
6226 return 1;
6227}
6228
6229function:set_cmute(playerid, toggle)
6230{
6231 // Set the player's command mute status
6232 User[playerid][accountCMuted] = toggle;
6233 return 1;
6234}
6235
6236function:set_cmutesec(playerid, sec)
6237{
6238 // Set the player's command mute seconds
6239 User[playerid][accountCMuteSec] = sec;
6240 return 1;
6241}
6242
6243function:check_jail(playerid)
6244{
6245 // Check the player's jail status
6246 return User[playerid][accountJail];
6247}
6248
6249function:check_jailsec(playerid)
6250{
6251 // Check the player's jail seconds if there is any
6252 return User[playerid][accountJailSec];
6253}
6254
6255function:set_jail(playerid, toggle)
6256{
6257 // Set the player's jail status
6258 User[playerid][accountJail] = toggle;
6259 return 1;
6260}
6261
6262function:set_jailsec(playerid, sec)
6263{
6264 // Set the player's jail seconds
6265 User[playerid][accountJailSec] = sec;
6266 return 1;
6267}
6268
6269function:check_id(playerid)
6270{
6271 return User[playerid][accountID];
6272}
6273
6274function:check_warn(playerid)
6275{
6276 // Check how many warns do the player got
6277 return User[playerid][accountWarn];
6278}
6279
6280function:set_warn(playerid, warn)
6281{
6282 // Sets how many warns to the player
6283 User[playerid][accountWarn] = warn;
6284 return 1;
6285}
6286
6287function:check_kills(playerid)
6288{
6289 // Check how many kills do the player got
6290 return User[playerid][accountKills];
6291}
6292
6293function:set_kill(playerid, kill)
6294{
6295 // Sets how many kills to the player
6296 User[playerid][accountKills] = kill;
6297 return 1;
6298}
6299
6300function:check_deaths(playerid)
6301{
6302 // Check how many deaths do the player got
6303 return User[playerid][accountDeaths];
6304}
6305
6306function:set_death(playerid, death)
6307{
6308 // Sets how many deaths to the player
6309 User[playerid][accountDeaths] = death;
6310 return 1;
6311}
6312
6313/*******************************************************************************
6314 * End of the Script - JakAdmin3.4.1 (c), 2016 *
6315 ******************************************************************************/