· 6 years ago · Jul 12, 2019, 04:24 PM
1/*Neo City Roleplay Script v1.0
2--------------------------------
3Developer's: TL-L & ShBaz
4Programmer's: Reo, Talha, Essam, RimL & Toni
5Mapper's: Aujhor, Emon, Ontor, Talha, Essam & RimL
6BETA Tester's: RimL, Reo, Toni, Ontor, Aujhor & Talha*/
7
8
9#include <a_samp>
10#include <a_mysql>
11#include <foreach>
12#include <zcmd>
13#include <sscanf2>
14#include <streamer>
15
16native WP_Hash(buffer[], len, const str[]);
17
18//------[MySQL-Information]--------//
19#define MYSQL_HOST "localhost"
20#define MYSQL_USER "root"
21#define MYSQL_PASS ""
22#define MYSQL_DATABASE "neocityroleplay"
23
24
25//----------[MySQL-Defines]-----------//
26
27/*new MySQL:mysql;
28new field[128];
29
30#define mysql_fetch_float(%0,%1) mysql_fetch_field(%0,field);
31%1=floatstr(field)
32#define mysql_fetch_string(%0,%1) mysql_fetch_field(%0,%1)
33#define mysql_fetch_int(%0,%1) mysql_fetch_field(%0,field);
34%1=strval(field)*/
35
36//--------[Dialog-Defines]--------//
37
38#define DIALOG_REGISTER (0)
39#define DIALOG_LOGIN (1)
40#define DIALOG_AGE (2)
41#define DIALOG_GENDER (3)
42
43//--------[Short-Defines]--------//
44
45#define SCM SendClientMessage
46#define SCMTA SendClientMessageToAll
47
48//----------[Admin-Defines]----------//
49
50//#define MAX_ADMIN_LEVEL 7
51//#define SETLEVEL_ADMIN 5
52
53//----------[Mathemetical-Defines]----------//
54
55#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
56
57
58//------------------[Enums]------------------//
59
60new
61 MySQL: Database, Corrupt_Check[MAX_PLAYERS];
62
63enum ENUM_PLAYER_DATA
64{
65 ID,
66 Name[25],
67 Password[65],
68 Salt[11],
69 PasswordFails,
70 Admin,
71 Kills,
72 Deaths,
73 Score,
74 Cash,
75 Age,
76 Gender[10],
77 Skin,
78 Faction,
79 Group,
80 Gang,
81
82 Cache: Player_Cache,
83 bool:LoggedIn
84}
85
86
87
88new pInfo[MAX_PLAYERS][ENUM_PLAYER_DATA];
89
90
91
92//---------------[Hex-Colors]----------------//
93
94#define COLOR_WHITE "{FFFFFF}"
95#define COLOR_BLACK "{000000}"
96#define COLOR_RED "{F81414}"
97#define COLOR_GREEN "{00FF22}"
98#define COLOR_BLUE "{0000FF}"
99#define COLOR_YELLOW "{FFFF00}"
100#define COLOR_ORANGE "{FF7F00}"
101#define COLOR_PINK "{FF69B4}"
102#define COLOR_GREY "{000000}"
103#define COLOR_DARK_GREY "{FF69B4}"
104#define COLOR_SKYBLUE "{00BFFF}"
105#define COLOR_LIGHTBLUE "{00CED1}"
106
107//----------------[0x-Colors]-----------------//
108#define COLOR_NCRP (0x0099FFFF)
109
110#define COLOR_WHITE2 (0xFFFFFFFF)
111#define COLOR_BLACK2 (0x000000FF)
112#define COLOR_RED2 (0xFF0000FF)
113#define COLOR_GREEN2 (0x00FF00FF)
114#define COLOR_BLUE2 (0x0000FFFF)
115#define COLOR_YELLOW2 (0xFFFF00FF)
116#define COLOR_ORANGE2 (0xFF7F00FF)
117#define COLOR_PINK2 (0xFF69B4FF)
118#define COLOR_GREY2 (0x000000FF)
119#define COLOR_DARK_GREY2 (0xFF69B4FF)
120#define COLOR_SKYBLUE2 (0x00BFFFFF)
121#define COLOR_LIGHTBLUE2 (0x00BFFFFF)
122#define COLOR_CADETBLUE (0x00CED1FF)
123
124#define COLOR_GLOBAL_CHAT (0xd2691eFF)
125#define COLOR_NEWBIE_CHAT (0x009acdFF)
126#define COLOR_OOC_CHAT (0xdcdcdcFF)
127#define COLOR_LOOC_CHAT (0xdcdcdcFF)
128#define COLOR_VIP_CHAT (0xAAEAE7FF)
129#define COLOR_ADMINS_CHAT (0x00bfffFF)
130#define COLOR_DEV_CHAT (0xeec900FF)
131#define COLOR_HELPERS_CHAT (0x00bfffFF)
132#define COLOR_FACTION_CHAT (0xffffffFF)
133#define COLOR_GROUP_CHAT (0xffffffFF)
134#define COLOR_GANG_CHAT (0xffffffFF)
135#define COLOR_FACRADIO_CHAT (0xffffffFF)
136#define COLOR_GRORADIO_CHAT (0xffffffFF)
137#define COLOR_GANRADIO_CHAT (0xffffffFF)
138#define COLOR_WALKIETALKIE_CHAT (0xffffffFF)
139#define COLOR_SMSCALL_CHAT (0xffffffsFF)
140#define COLOR_RP (0xC2A2DAFF)
141
142
143#define COLOR_GOV(0x4ed7f3FF
144#define COLOR_CIA (0x4BA9FCFF)
145#define COLOR_FBI (0x9797FFFF)
146#define COLOR_LSMF (0x34DF71FF)
147#define COLOR_MI6 (0xEC3032FF)
148#define COLOR_LSPD (0x3C5CFFFF)
149#define COLOR_FMD (0xFFA4D2FF)
150#define COLOR_SAN(0x009797FF)
151
152
153#define COLOR_CDA (0x77BFFFFF)
154#define COLOR_HMA(0x111111FF)
155#define COLOR_TS(0x7891ECFF)
156#define COLOR_TM(0xC979F0FF)
157#define COLOR_TSLS(0xFFC109FF)
158
159//----------[Info Defines]----------//
160
161main()
162{
163 print("\n----------------------------------");
164 print("Neo City Roleplay script running.....");
165 print("----------------------------------\n");
166}
167
168public OnGameModeInit()
169{
170 UsePlayerPedAnims();
171 AddPlayerClass(0, 1444.0865, -2286.6409, 15.3960, -269.1425, 0, 0, 0, 0, 0, 0);
172 SetGameModeText("NC:RP v1.0");
173 new MySQLOpt: option_id = mysql_init_options();
174 mysql_set_option(option_id, AUTO_RECONNECT, true);
175 Database = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE, option_id);
176 if(Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0)
177 {
178 print("I couldn't connect to the MySQL server, closing.");
179 SendRconCommand("exit");
180 return 1;
181 }
182 print("I have connected to the MySQL server.");
183 mysql_tquery(Database, "CREATE TABLE IF NOT EXISTS `PLAYERS` (`ID` int(11) NOT NULL AUTO_INCREMENT,`USERNAME` varchar(24) NOT NULL,`PASSWORD` char(65) NOT NULL,`SALT` char(11) NOT NULL,`SCORE` mediumint(7), `KILLS` mediumint(7), `CASH` mediumint(7) NOT NULL DEFAULT '0',`DEATHS` mediumint(7) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`), UNIQUE KEY `USERNAME` (`USERNAME`))");
184 return 1;
185}
186
187public OnGameModeExit()
188{
189 foreach(new i: Player)
190 {
191 if(IsPlayerConnected(i))
192 {
193 OnPlayerDisconnect(i, 1);
194 }
195 }
196
197 mysql_close(Database);
198 return 1;
199}
200
201public OnPlayerRequestClass(playerid, classid)
202{
203 return 1;
204}
205
206public OnPlayerConnect(playerid)
207{
208 SetPlayerColor(playerid, -1);
209
210 new DB_Query[115];
211
212 pInfo[playerid][Kills] = 0;
213 pInfo[playerid][Deaths] = 0;
214 pInfo[playerid][PasswordFails] = 0;
215
216 GetPlayerName(playerid, pInfo[playerid][Name], MAX_PLAYER_NAME);
217 Corrupt_Check[playerid]++;
218
219 mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `USERNAME` = '%e' LIMIT 1", pInfo[playerid][Name]);
220 mysql_tquery(Database, DB_Query, "OnPlayerDataCheck", "ii", playerid, Corrupt_Check[playerid]);
221 return 1;
222}
223
224public OnPlayerDisconnect(playerid, reason)
225{
226 Corrupt_Check[playerid]++;
227
228 new DB_Query[256];
229
230 mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = %d, `CASH` = %d, `KILLS` = %d, `DEATHS` = %d WHERE `ID` = %d LIMIT 1",
231 pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][ID]);
232
233 mysql_tquery(Database, DB_Query);
234
235 if(cache_is_valid(pInfo[playerid][Player_Cache]))
236 {
237 cache_delete(pInfo[playerid][Player_Cache]);
238 pInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
239 }
240
241 pInfo[playerid][LoggedIn] = false;
242 print("OnPlayerDisconnect has been called.");
243 return 1;
244}
245
246public OnPlayerSpawn(playerid)
247{
248 return 1;
249}
250
251public OnPlayerDeath(playerid, killerid, reason)
252{
253 if(killerid != INVALID_PLAYER_ID)
254 {
255 pInfo[killerid][Kills]++;
256 pInfo[playerid][Deaths]++;
257 }
258 return 1;
259}
260
261public OnVehicleSpawn(vehicleid)
262{
263 return 1;
264}
265
266public OnVehicleDeath(vehicleid, killerid)
267{
268 return 1;
269}
270
271public OnPlayerText(playerid, text[])
272{
273 return 1;
274}
275
276public OnPlayerCommandText(playerid, cmdtext[])
277{
278 if (strcmp("/mycommand", cmdtext, true, 10) == 0)
279 {
280 // Do something here
281 return 1;
282 }
283 return 0;
284}
285
286public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
287{
288 return 1;
289}
290
291public OnPlayerExitVehicle(playerid, vehicleid)
292{
293 return 1;
294}
295
296public OnPlayerStateChange(playerid, newstate, oldstate)
297{
298 return 1;
299}
300
301public OnPlayerEnterCheckpoint(playerid)
302{
303 return 1;
304}
305
306public OnPlayerLeaveCheckpoint(playerid)
307{
308 return 1;
309}
310
311public OnPlayerEnterRaceCheckpoint(playerid)
312{
313 return 1;
314}
315
316public OnPlayerLeaveRaceCheckpoint(playerid)
317{
318 return 1;
319}
320
321public OnRconCommand(cmd[])
322{
323 return 1;
324}
325
326public OnPlayerRequestSpawn(playerid)
327{
328 if(pInfo[playerid][LoggedIn] == false) return 0;
329 return 1;
330}
331
332public OnObjectMoved(objectid)
333{
334 return 1;
335}
336
337public OnPlayerObjectMoved(playerid, objectid)
338{
339 return 1;
340}
341
342public OnPlayerPickUpPickup(playerid, pickupid)
343{
344 return 1;
345}
346
347public OnVehicleMod(playerid, vehicleid, componentid)
348{
349 return 1;
350}
351
352public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
353{
354 return 1;
355}
356
357public OnVehicleRespray(playerid, vehicleid, color1, color2)
358{
359 return 1;
360}
361
362public OnPlayerSelectedMenuRow(playerid, row)
363{
364 return 1;
365}
366
367public OnPlayerExitedMenu(playerid)
368{
369 return 1;
370}
371
372public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
373{
374 return 1;
375}
376
377public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
378{
379 return 1;
380}
381
382public OnRconLoginAttempt(ip[], password[], success)
383{
384 return 1;
385}
386
387public OnPlayerUpdate(playerid)
388{
389 return 1;
390}
391
392public OnPlayerStreamIn(playerid, forplayerid)
393{
394 return 1;
395}
396
397public OnPlayerStreamOut(playerid, forplayerid)
398{
399 return 1;
400}
401
402public OnVehicleStreamIn(vehicleid, forplayerid)
403{
404 return 1;
405}
406
407public OnVehicleStreamOut(vehicleid, forplayerid)
408{
409 return 1;
410}
411
412public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
413{
414 switch (dialogid)
415 {
416 case DIALOG_LOGIN:
417 {
418 if(!response) return Kick(playerid);
419
420 new Salted_Key[65];
421 SHA256_PassHash(inputtext, pInfo[playerid][Salt], Salted_Key, 65);
422
423 if(strcmp(Salted_Key, pInfo[playerid][Password]) == 0)
424 {
425
426 cache_set_active(pInfo[playerid][Player_Cache]);
427
428 cache_get_value_int(0, "ID", pInfo[playerid][ID]);
429
430 cache_get_value_int(0, "KILLS", pInfo[playerid][Kills]);
431 cache_get_value_int(0, "DEATHS", pInfo[playerid][Deaths]);
432
433 cache_get_value_int(0, "SCORE", pInfo[playerid][Score]);
434 cache_get_value_int(0, "CASH", pInfo[playerid][Cash]);
435
436 cache_get_value_int(0, "GENDER", pInfo[playerid][Gender]);
437 cache_get_value_int(0, "AGE", pInfo[playerid][Age]);
438
439 cache_get_value_int(0, "SKIN", pInfo[playerid][Skin]);
440
441 SetPlayerScore(playerid, pInfo[playerid][Score]);
442
443 ResetPlayerMoney(playerid);
444 GivePlayerMoney(playerid, pInfo[playerid][Cash]);
445
446 cache_delete(pInfo[playerid][Player_Cache]);
447 pInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
448 pInfo[playerid][LoggedIn] = true;
449 SCM(playerid, COLOR_WHITE2, "You have successfully logged into your account!");
450 }
451 else
452 {
453 new String[100];
454
455 pInfo[playerid][PasswordFails] += 1;
456 printf("%s has been failed to login. (%d)", pInfo[playerid][Name], pInfo[playerid][PasswordFails]);
457
458 if (pInfo[playerid][PasswordFails] >= 3)
459 {
460 format(String, sizeof(String), "%s has been kicked Reason: {FF0000}(%d/3) Login fails.", pInfo[playerid][Name], pInfo[playerid][PasswordFails]);
461 SCMTA(0x969696FF, String);
462 Kick(playerid);
463 }
464 else
465 {
466 format(String, sizeof(String), "Wrong password, you have %d out of 3 tries.", pInfo[playerid][PasswordFails]);
467 SCM(playerid, 0xFF0000FF, String);
468
469 format(String, sizeof(String), "{FFFFFF}Welcome back, %s.\n\n{0099FF}This account is already registered.\n\
470 {0099FF}Please, input your password below to proceed to the game.\n\n", pInfo[playerid][Name]);
471 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Welcome Back!", String, "Login", "Leave");
472 }
473 }
474 }
475 case DIALOG_AGE:
476 {
477 if(!response) return Kick(playerid);
478
479 if( inputtext[playerid] < 18 || inputtext[playerid] > 50)
480
481 {
482
483 SCM(playerid, 0x969696FF, "Invalid AGE length, should be 18 - 50.");
484
485 new Integer[100];
486
487 format(Integer, sizeof(Integer), "{FFFFFF}Welcome %s.\n\n {0099FF}Please, input your age below to proceed.\n\n", pInfo[playerid][Name]);
488 ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Account Registration - Age", Integer, "Proceed", "Leave");
489 }
490 else
491 {
492 pInfo[playerid][Age] = strlen(inputtext);
493 new String[50];
494
495 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n {0099FF}Please, input your gender below to proceed. (1 - MALE || 2 - FEMALE) || 3 - OTHER\n\n", pInfo[playerid][Name]);
496 ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_INPUT, "Account Registration - Gender", String, "Proceed", "Leave");
497 }
498 }
499 case DIALOG_GENDER:
500 {
501 if(!response) return Kick(playerid);
502
503 if(!strcmp(inputtext, "MALE", true) || !strcmp(inputtext, "FEMALE", true) || !strcmp(inputtext,"OTHER", true))
504 {
505 new String[50];
506
507 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n {0099FF}Please, input your gender below to proceed. (1 - MALE || 2 - FEMALE) || 3 - OTHER\n\n", pInfo[playerid][Name]);
508 ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_INPUT, "Account Registration - Gender", String, "Proceed", "Leave");
509 SendClientMessage(playerid, -1, " Please type: MALE OR FEMALE OR OTHER");
510 return 1;
511 }
512
513 {
514
515 strcpy(pInfo[playerid][Gender], inputtext, 10);
516
517 switch(pInfo[playerid][Gender])
518 {
519 case 1: pInfo[playerid][Skin] = 250, SCM(playerid, COLOR_WHITE2, "Alright, so you're a Male.");
520 case 2: pInfo[playerid][Skin] = 191, SCM(playerid, COLOR_WHITE2, "Alright, so you're a Female.");
521 case 3: pInfo[playerid][Skin] = 0, SCM(playerid, COLOR_WHITE2, "Alright, so you're in Other Gender, We give you CJ skin.");
522 }
523 new DB_Query[225];
524 mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `PLAYERS` (`USERNAME`, `PASSWORD`, `SALT`, `SCORE`, `KILLS`, `CASH`, `DEATHS`, `AGE`, `GENDER`, `SKIN`)\
525 VALUES ('%e', '%s', '%e', '20', '0', '0', '0', '%i', '%i', %i)", pInfo[playerid][Name], pInfo[playerid][Password], pInfo[playerid][Salt], pInfo[playerid][Age], pInfo[playerid][Gender], pInfo[playerid][Skin]);
526 mysql_tquery(Database, DB_Query, "OnPlayerRegister", "d", playerid);
527 return 1;
528 }
529 }
530
531 case DIALOG_REGISTER:
532 {
533 if(!response) return Kick(playerid);
534
535 if(strlen(inputtext) <= 5 || strlen(inputtext) > 60)
536 {
537
538 SCM(playerid, 0x969696FF, "Invalid password length, should be 5 - 60.");
539
540 new String[150];
541
542 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}This account is not registered.\n\
543 {0099FF}Please, input your password below to proceed.\n\n", pInfo[playerid][Name]);
544 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account Registration", String, "Register", "Leave");
545 }
546 else
547 {
548 for (new i = 0; i < 10; i++)
549 {
550 pInfo[playerid][Salt][i] = random(79) + 47;
551 }
552
553 pInfo[playerid][Salt][10] = 0;
554 SHA256_PassHash(inputtext, pInfo[playerid][Salt], pInfo[playerid][Password], 65);
555
556 new Integer[100];
557
558 format(Integer, sizeof(Integer), "{FFFFFF}Welcome %s.\n\n {0099FF}Please, input your age below to proceed.\n\n", pInfo[playerid][Name]);
559 ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Account Registration - AGE", Integer, "Proceed", "Leave");
560 }
561 }
562 }
563 return 1;
564}
565
566public OnPlayerClickPlayer(playerid, clickedplayerid, source)
567{
568 return 1;
569}
570
571//----------[Forward-Public's]----------//
572
573forward public OnPlayerDataCheck(playerid, corrupt_check);
574public OnPlayerDataCheck(playerid, corrupt_check)
575{
576 if (corrupt_check != Corrupt_Check[playerid]) return Kick(playerid);
577
578 new String[150];
579
580 if(cache_num_rows() > 0)
581 {
582
583 cache_get_value(0, "PASSWORD", pInfo[playerid][Password], 65);
584 cache_get_value(0, "SALT", pInfo[playerid][Salt], 11);
585
586 pInfo[playerid][Player_Cache] = cache_save();
587
588 format(String, sizeof(String), "{FFFFFF}Welcome back, %s.\n\n{0099FF}This account is already registered.\n\
589 {0099FF}Please, input your password below to proceed to the game.\n\n", pInfo[playerid][Name]);
590 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Welcome Back!", String, "Login", "Leave");
591 }
592 else
593 {
594 format(String, sizeof(String), "{FFFFFF}Welcome %s.\n\n{0099FF}This account is not registered.\n\
595 {0099FF}Please, input your password below to proceed to the game.\n\n", pInfo[playerid][Name]);
596 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account Registration", String, "Register", "Leave");
597 }
598 return 1;
599}
600
601forward public OnPlayerRegister(playerid);
602public OnPlayerRegister(playerid)
603{
604 //SetSpawnInfo(playerid, 0, 250, 1444.0865, -2286.6409, 15.3960, -269.1425, 0, 0, 0, 0, 0, 0);
605 GivePlayerMoney(playerid, 500);
606 SCM(playerid, 0xFFFFFFFF, "Welcome to {0099FF}Neo City Roleplay!");
607 pInfo[playerid][LoggedIn] = true;
608 return 1;
609}
610
611forward public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
612public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
613{
614 if(IsPlayerConnected(playerid))
615{
616 new Float:posx, Float:posy, Float:posz;
617 new Float:oldposx, Float:oldposy, Float:oldposz;
618 new Float:tempposx, Float:tempposy, Float:tempposz;
619 GetPlayerPos(playerid, oldposx, oldposy, oldposz);
620 for(new i = 0; i < MAX_PLAYERS; i++)
621{
622 if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
623{
624 GetPlayerPos(i, posx, posy, posz);
625 tempposx = (oldposx -posx);
626 tempposy = (oldposy -posy);
627 tempposz = (oldposz -posz);
628 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
629{
630 SCM(i, col1, string);
631}
632 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
633{
634 SCM(i, col2, string);
635}
636 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
637{
638 SCM(i, col3, string);
639}
640 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
641{
642 SCM(i, col4, string);
643}
644 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
645{
646 SCM(i, col5, string);
647}
648}
649 else
650{
651 SCM(i, col1, string);
652}
653}
654}
655 return 1;
656}
657
658//------------[General-Commands]------------//
659CMD:suicide(playerid, params[])
660{
661 SetPlayerHealth(playerid, 0);
662 return 1;
663}
664
665CMD:me(playerid, params[])
666{
667 if(isnull(params)) return SCM(playerid, COLOR_WHITE2, "SYNTAX: /me [action]");
668 new string[128];
669 format(string, sizeof(string), "* %s %s", GetPlayerNameEx(playerid), params);
670 ProxDetector(30.0, playerid, string, COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP);
671 return 1;
672}
673
674CMD:do(playerid, params[])
675{
676 if(isnull(params)) return SCM(playerid, COLOR_WHITE2, "SYNTAX: /do [action]");
677 new string[128];
678 format(string, sizeof(string), "* %s (( %s ))", params, GetPlayerNameEx(playerid));
679 ProxDetector(30.0, playerid, string, COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP);
680 return 1;
681}
682
683CMD:gp(playerid, params[])
684{
685 if(isnull(params)) return SCM(playerid, COLOR_WHITE2, "SYNTAX: /gp [gameplan]");
686 new string[128];
687 format(string, sizeof(string), "[Gameplan] %s", params, GetPlayerNameEx(playerid));
688 ProxDetector(30.0, playerid, string, COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP);
689 return 1;
690}
691
692CMD:getnaked(playerid, params[])
693{
694 ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
695 PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
696 SetPlayerSkin(playerid, 252);
697 new string[128];
698 format(string, sizeof(string), "* %s switches back to their clothes.",GetPlayerNameEx(playerid));
699 ProxDetector(20.0, playerid, string, COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP,COLOR_RP);
700 return 1;
701}
702//----------------[Help-Commands]-------------------//
703
704CMD:help(playerid, params[])
705{
706 SCM(playerid, COLOR_NCRP, "____________________________________Paradise City Roleplay____________________________________");
707 SCM(playerid, COLOR_NCRP, "Account: {ffffff}/credits, /serverinfo, /settings, /rules, /stats, /inv, /kcp");
708 SCM(playerid, COLOR_NCRP, "Account: {ffffff}/changepass, /buylevel, /upgrade, /reset, /discord, /web, /faq");
709 SCM(playerid, COLOR_NCRP, "General: {ffffff}/me, /do, /ask, /getassist, /gps, /time, /id, /buy, /getnaked");
710 SCM(playerid, COLOR_NCRP, "General: {ffffff}/factions, /groups, /gangs, /accept, /cancel , /eject, /pbs");
711 SCM(playerid, COLOR_NCRP, "General: {ffffff}/pay, /charity, /killme, /levels, /calculate, /licenses, /contract");
712 SCM(playerid, COLOR_NCRP, "Others: {ffffff}/phonehelp, /laptophelp, /vehiclehelp, /househelp, /toyhelp, /jobhelp, /animhelp,/chathelp");
713 SCM(playerid, COLOR_NCRP, "Others: {ffffff}/businesshelp /ecohelp, /leaderhelp, /factionhelp, /grouphelp, /ganghelp, /pbhelp");
714 return 1;
715}
716
717CMD:credits(playerid, params[])
718{
719 SCM(playerid, COLOR_CADETBLUE, "____________________________Developers____________________________");
720 SCM(playerid, COLOR_CADETBLUE, "Developer's: {ffffff}TL-L & ShBaz");
721 SCM(playerid, COLOR_CADETBLUE, "Programmer's: {ffffff}Reo, Essam, Talha & RimL");
722 SCM(playerid, COLOR_CADETBLUE, "Mappers: {ffffff}Aujhor, Emon, Ontor, Talha, Essam, Toni & RimL");
723 SCM(playerid, COLOR_CADETBLUE, "BETA Testers: {ffffff}RimL, Reo, Toni, Ontor, Aujhor & Talha");
724 return 1;
725}
726
727CMD:serverinfo(playerid, params[])
728{
729 SCM(playerid, COLOR_NCRP, "____________________Information____________________");
730 SCM(playerid, COLOR_NCRP, "Name: {ffffff}Neo City Roleplay");
731 SCM(playerid, COLOR_NCRP, "Gamemode: {ffffff}NC:RP v1.0");
732 SCM(playerid, COLOR_NCRP, "Map: {ffffff}Neo City");
733 SCM(playerid, COLOR_NCRP, "Version: {ffffff}0.3.7 R2");
734 SCM(playerid, COLOR_NCRP, "RP: {ffffff}Light");
735 SCM(playerid, COLOR_NCRP, "Status: {ffffff}Scripting in progress");
736 return 1;
737}
738
739CMD:discord(playerid, params[])
740{
741 SCM(playerid, COLOR_NCRP, "____________________Discord____________________");
742 SCM(playerid, COLOR_NCRP, "Join our discord: {ffffff}https://discord.gg/HXvUuUK");
743 return 1;
744}
745
746CMD:web(playerid, params[])
747{
748 SCM(playerid, COLOR_NCRP, "____________________WEB-Info____________________");
749 SCM(playerid, COLOR_NCRP, "Website: {ffffff}https://paradisecityroleplay.com");
750 SCM(playerid, COLOR_NCRP, "Forums: {ffffff}http://neocityrp.net");
751 return 1;
752}
753
754CMD:phonehelp(playerid, params[])
755{
756 SCM(playerid, COLOR_NCRP, "____________________Phone-Commands____________________");
757 SCM(playerid, COLOR_NCRP, "Phone: {ffffff}/togpho, /call, /sms etc.");
758 return 1;
759}
760
761CMD:laptophelp(playerid, params[])
762{
763 SCM(playerid, COLOR_NCRP, "______________________________Laptop-Commands______________________________");
764 SCM(playerid, COLOR_NCRP, "Laptop: {ffffff}/laptop, /post, /lmap, /search, /net, /login, /media etc.");
765 return 1;
766}
767
768CMD:vehiclehelp(playerid, params[])
769{
770 SCM(playerid, COLOR_NCRP, "______________________________Vehicle-Commands______________________________");
771 SCM(playerid, COLOR_NCRP, "Vehicle: {ffffff}/vengine, /vlights, /vhood, /vtrunk, /fuel, /seatbelt etc.");
772 return 1;
773}
774
775CMD:househelp(playerid, params[])
776{
777 SCM(playerid, COLOR_NCRP, "______________________________House-Commands______________________________");
778 SCM(playerid, COLOR_NCRP, "House: {ffffff}/houseinfo, /lock, /hupgrade, /sellhouse, /buyhouse, /hinfo");
779 SCM(playerid, COLOR_NCRP, "House: {ffffff}/houseput, /houseget, /housebalance /evact, /evactall, /hparty.");
780 return 1;
781}
782
783CMD:chathelp(playerid, params[])
784{
785 SCM(playerid, COLOR_NCRP, "______________________________Chat-Commands______________________________");
786 SCM(playerid, COLOR_NCRP, "Phone: {ffffff}/tognew(ewbie), /togglo(bal), /toggooc, /togvip");
787 SCM(playerid, COLOR_NCRP, "Phone: {ffffff}/togdev, /toghc,/togfac, /toggro, /toggan, /tognews");
788 return 1;
789}
790
791CMD:pbhelp(playerid, params[])
792{
793 SCM(playerid, COLOR_NCRP, "______________________Paintball-Commands______________________");
794 SCM(playerid, COLOR_NCRP, "Paintball: {ffffff}/paintball, /pbpoints, /pbinvite, /pbexit");
795 return 1;
796}
797
798CMD:ecohelp(playerid, params[])
799{
800 SCM(playerid, COLOR_NCRP, "______________________________Economical-Commands______________________________");
801 SCM(playerid, COLOR_NCRP, "Bank: {ffffff}/bankinfo, /insureinfo, /buyinsurance, /balance, /withdraw");
802 SCM(playerid, COLOR_NCRP, "Bank: {ffffff}/deposit, /abalance, /awithdraw, /adeposit");
803 return 1;
804}
805
806//-----------[Admin-Commands]-----------//
807
808/*CMD:makeadmin(playerid, params[])
809{
810 if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= SETLEVEL_ADMIN)
811 {
812 new level, target;
813 if(sscanf(params, "ui", target, level)) return SCM(playerid, COLOR_WHITE2, "Usage: /makeadmin [playerid/name] [level]");
814 if(target == INVALID_PLAYER_ID) return SCM(playerid, COLOR_WHITE2, "Enter a valid player ID/name!");
815 new string[128], Query[500], str2[50];
816 if(level < 0 || level > MAX_ADMIN_LEVEL)
817 {
818 format(string, sizeof(string), "Enter a level between 0 and %d!", MAX_ADMIN_LEVEL);
819 SCM(playerid, COLOR_RED2,string);
820 return 1;
821 }
822 format(Query, 500, "UPDATE `player` SET `Admin` = '%d' WHERE `Id` = '%d' LIMIT 1", level, pInfo[target][ID]);
823 //mysql_query(string);
824 pInfo[target][Admin] = level;
825 format(string, 256, "You have set %s[%d]'s admin level to %d.", pInfo[target][Name], target, level);
826 SCM(playerid, COLOR_GREEN2, string);
827 format(string, 256, "Admin %s has set your admin level to %d.", pInfo[playerid][Name], level);
828 SCM(target, COLOR_YELLOW2, string);
829 for (new i=0; i<MAX_PLAYERS; i++)
830 {
831 if(pInfo[i][LoggedIn] == 1 && pInfo[i][Admin])
832 {
833 format(str2, sizeof(str2), "Admin %s[%d] has used the following command: Setlevel", pInfo[playerid][Name], playerid);
834 SCM(i,COLOR_GREEN2,string);
835 }
836 }
837 PlayerPlaySound(target,1057,0.0,0.0,0.0);
838 }
839 else return SCM(playerid, COLOR_RED2, "Your not an admin!");
840 return 1;
841}
842*/
843
844
845//----------------[Dialogs]----------------//
846
847//----------[Stock-Functions]----------]
848
849stock GetPlayerNameEx(playerid)
850{
851 new pName[25];
852 GetPlayerName(playerid, pName, sizeof(pName));
853 return pName;
854}
855
856GetPlayerGender(playerid)
857{
858 new get[10];
859 switch( pInfo[playerid][Gender])
860 {
861 case 1: get = "Male";
862 case 2: get = "Female";
863 case 3: get = "Other";
864 }
865 return get;
866}
867
868stock sscanf(string[], format[], {Float,_}:...)
869{
870 #if defined isnull
871 if (isnull(string))
872 #else
873 if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
874 #endif
875 {
876 return format[0];
877 }
878 #pragma tabsize 4
879 new
880 formatPos = 0,
881 stringPos = 0,
882 paramPos = 2,
883 paramCount = numargs(),
884 delim = ' ';
885 while (string[stringPos] && string[stringPos] <= ' ')
886 {
887 stringPos++;
888 }
889 while (paramPos < paramCount && string[stringPos])
890 {
891 switch (format[formatPos++])
892 {
893 case '\0':
894 {
895 return 0;
896 }
897 case 'i', 'd':
898 {
899 new
900 neg = 1,
901 num = 0,
902 ch = string[stringPos];
903 if (ch == '-')
904 {
905 neg = -1;
906 ch = string[++stringPos];
907 }
908 do
909 {
910 stringPos++;
911 if ('0' <= ch <= '9')
912 {
913 num = (num * 10) + (ch - '0');
914 }
915 else
916 {
917 return -1;
918 }
919 }
920 while ((ch = string[stringPos]) > ' ' && ch != delim);
921 setarg(paramPos, 0, num * neg);
922 }
923 case 'h', 'x':
924 {
925 new
926 num = 0,
927 ch = string[stringPos];
928 do
929 {
930 stringPos++;
931 switch (ch)
932 {
933 case 'x', 'X':
934 {
935 num = 0;
936 continue;
937 }
938 case '0' .. '9':
939 {
940 num = (num << 4) | (ch - '0');
941 }
942 case 'a' .. 'f':
943 {
944 num = (num << 4) | (ch - ('a' - 10));
945 }
946 case 'A' .. 'F':
947 {
948 num = (num << 4) | (ch - ('A' - 10));
949 }
950 default:
951 {
952 return -1;
953 }
954 }
955 }
956 while ((ch = string[stringPos]) > ' ' && ch != delim);
957 setarg(paramPos, 0, num);
958 }
959 case 'c':
960 {
961 setarg(paramPos, 0, string[stringPos++]);
962 }
963 case 'f':
964 {
965
966 new changestr[16], changepos = 0, strpos = stringPos;
967 while(changepos < 16 && string[strpos] && string[strpos] != delim)
968 {
969 changestr[changepos++] = string[strpos++];
970 }
971 changestr[changepos] = '\0';
972 setarg(paramPos,0,_:floatstr(changestr));
973 }
974 case 'p':
975 {
976 delim = format[formatPos++];
977 continue;
978 }
979 case '\'':
980 {
981 new
982 end = formatPos - 1,
983 ch;
984 while ((ch = format[++end]) && ch != '\'') {}
985 if (!ch)
986 {
987 return -1;
988 }
989 format[end] = '\0';
990 if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
991 {
992 if (format[end + 1])
993 {
994 return -1;
995 }
996 return 0;
997 }
998 format[end] = '\'';
999 stringPos = ch + (end - formatPos);
1000 formatPos = end + 1;
1001 }
1002 case 'u':
1003 {
1004 new
1005 end = stringPos - 1,
1006 id = 0,
1007 bool:num = true,
1008 ch;
1009 while ((ch = string[++end]) && ch != delim)
1010 {
1011 if (num)
1012 {
1013 if ('0' <= ch <= '9')
1014 {
1015 id = (id * 10) + (ch - '0');
1016 }
1017 else
1018 {
1019 num = false;
1020 }
1021 }
1022 }
1023 if (num && IsPlayerConnected(id))
1024 {
1025 setarg(paramPos, 0, id);
1026 }
1027 else
1028 {
1029 #if !defined foreach
1030 #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
1031 #define __SSCANF_FOREACH__
1032 #endif
1033 string[end] = '\0';
1034 num = false;
1035 new
1036 name[MAX_PLAYER_NAME];
1037 id = end - stringPos;
1038 foreach (Player, playerid)
1039 {
1040 GetPlayerName(playerid, name, sizeof (name));
1041 if (!strcmp(name, string[stringPos], true, id))
1042 {
1043 setarg(paramPos, 0, playerid);
1044 num = true;
1045 break;
1046 }
1047 }
1048 if (!num)
1049 {
1050 setarg(paramPos, 0, INVALID_PLAYER_ID);
1051 }
1052 string[end] = ch;
1053 #if defined __SSCANF_FOREACH__
1054 #undef foreach
1055 #undef __SSCANF_FOREACH__
1056 #endif
1057 }
1058 stringPos = end;
1059 }
1060 case 's', 'z':
1061 {
1062 new
1063 i = 0,
1064 ch;
1065 if (format[formatPos])
1066 {
1067 while ((ch = string[stringPos++]) && ch != delim)
1068 {
1069 setarg(paramPos, i++, ch);
1070 }
1071 if (!i)
1072 {
1073 return -1;
1074 }
1075 }
1076 else
1077 {
1078 while ((ch = string[stringPos++]))
1079 {
1080 setarg(paramPos, i++, ch);
1081 }
1082 }
1083 stringPos--;
1084 setarg(paramPos, i, '\0');
1085 }
1086 default:
1087 {
1088 continue;
1089 }
1090 }
1091 while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
1092 {
1093 stringPos++;
1094 }
1095 while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
1096 {
1097 stringPos++;
1098 }
1099 paramPos++;
1100 }
1101 do
1102 {
1103 if ((delim = format[formatPos++]) > ' ')
1104 {
1105 if (delim == '\'')
1106 {
1107 while ((delim = format[formatPos++]) && delim != '\'') {}
1108 }
1109 else if (delim != 'z')
1110 {
1111 return delim;
1112 }
1113 }
1114 }
1115 while (delim > ' ');
1116 return 0;
1117}