/
GM with INI database.pwn
1667 lines (1505 loc) · 67.4 KB
/
GM with INI database.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <a_samp>
#include <a_players>
#include <YSI\y_ini>
#include <zcmd>
#include <foreach>
#include <streamer>
#include <sscanf2>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define DIALOG_STYLE_SKIN 5
#define PATH "/Users/%s.ini"
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_LIGHTBLUE 0x33CCFFAA
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pBanned,
pScore
}
new IsSpectating[MAX_PLAYERS];
new PlayerInfo[MAX_PLAYERS][pInfo];
new PlayerText:ConnectTD[12];
forward RandomMessage();
new Text:randommsg;
new RandomMessages[][] =
{
"World Stunting Gaming!",
"Type /cmds to see list of commands",
"Type /admins to see current online admins.",
"Obey the /rules otherwise you'll be punished",
"Type /startstunt to start your stunting world!",
"Type /lobby to get back to lobby and have some rest",
"Type /teleports to see whole teleports menu",
"Type /tune to add nos and repair your car!",
"Type /weaps to spawn any weaponaries",
"Type /car to spawn a vehicle"
// You can define more messages, but make sure you have , everywhere, except at the last message
};
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
/*Credits to Dracoblue*/
main()
{
print("\n----------------------------------");
print(" Stunting world by Flaken loaded");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("Minigames v.0.1.0");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SetTimer("RandomMessage",8000,1);
randommsg = TextDrawCreate(7.000000, 427.000000, "");
TextDrawBackgroundColor(randommsg, 255);
TextDrawFont(randommsg, 1);
TextDrawLetterSize(randommsg, 0.379999, 1.499999);
TextDrawColor(randommsg, -1);
TextDrawSetOutline(randommsg, 1);
TextDrawSetProportional(randommsg, 1);
//Put the maps codes which I uploaded on the page here (below here)
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
PlayAudioStreamForPlayer(playerid, "http://bugi.oulu.fi/~lmanner/out_of_tune/dp/mp3/09-out_of_tune-call_of_duty.mp3");
LoadPlayerTextDraws(playerid);
for (new i = 0; i < 12; i++ )
PlayerTextDrawShow(playerid, ConnectTD[i]);
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pScore] = 0;
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pCash] = 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
INI_Close(File);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,964.106994,-53.205497,1001.124572);
SetPlayerInterior(playerid, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Welcome to Stunting World server!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Now, type /startstunt to join the Stunting World");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"To go back to the lobby, type /lobby");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /tune to add nos turbo and to fix your car");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /car to spawn a vehicle");
TextDrawShowForPlayer(playerid, randommsg);
PlayerTextDrawHide(playerid, ConnectTD[0]);
PlayerTextDrawHide(playerid, ConnectTD[1]);
PlayerTextDrawHide(playerid, ConnectTD[2]);
PlayerTextDrawHide(playerid, ConnectTD[3]);
PlayerTextDrawHide(playerid, ConnectTD[4]);
PlayerTextDrawHide(playerid, ConnectTD[5]);
PlayerTextDrawHide(playerid, ConnectTD[6]);
PlayerTextDrawHide(playerid, ConnectTD[7]);
PlayerTextDrawHide(playerid, ConnectTD[8]);
PlayerTextDrawHide(playerid, ConnectTD[9]);
PlayerTextDrawHide(playerid, ConnectTD[10]);
PlayerTextDrawHide(playerid, ConnectTD[11]);
StopAudioStreamForPlayer(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
PlayerInfo[playerid][pScore] ++;
if(IsPlayerConnected(killerid)) //Checks if there really is a "killer" - more ways of death are for example falling from great heights, so there isn't a killer there!
{
SetPlayerScore(killerid,GetPlayerScore(playerid)+5);
GivePlayerMoney(killerid, 500); //Give the player 500 dollars
SendClientMessage(killerid, COLOR_LIGHTBLUE, "*You have won $500 and 5 scores from killing someone*"); // Send message to killer
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(response)
{
new skinid, message[64];
skinid = strval(inputtext);
if(skinid < 0 || skinid > 299)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "SERVER: Skin id may be between 0 and 299.");
}
else
{
SetPlayerSkin(playerid, skinid);
format(message, sizeof(message), "SERVER: You have changed your skin id to %d.", skinid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, message);
}
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You now have succesfully registered on our database!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
CMD:startstunt(playerid, params[])
{
SetPlayerPos(playerid,384.0750,2541.4612,16.5391);
SetPlayerInterior(playerid, 0);
SetPlayerHealth(playerid, 1000);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"You have entered the stunt world, type /lobby to go back to lobby for resting");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /teleports for a list of teleports commands");
return 1;
}
CMD:lobby(playerid, params[])
{
SetPlayerPos(playerid,964.106994,-53.205497,1001.124572);
SetPlayerInterior(playerid, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"You have entered the lobby, welcome back, take some rests!");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Type /startstunt if you feel you wanna go back stunting.");
return 1;
}
CMD:kick(playerid, params[])
{
new id, reason[128];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /kick [id/name][reason]");
else if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick yourself!");
else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick another admin!");
else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!");
else {
new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "Administrator %s(%d) has kicked player %s(%d)| Reason: %s", Name, playerid, Name2, id);
SendClientMessageToAll(COLOR_LIGHTBLUE, KickMessage);
Kick(id);
}
return 1;
}
CMD:warn(playerid, params[])
{
new id, reason[128];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_LIGHTBLUE,"Usage: /warn [id/name] [reason]");
else if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not warn yourself!");
else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not warn another admin!");
else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!");
else
{
new Name[MAX_PLAYER_NAME], WarnMessage[128];
new Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(WarnMessage, sizeof(WarnMessage), "Administrator %s(%d) has warned %s(%d) | Reason: %s", Name, playerid, Name2, id);
SendClientMessageToAll(COLOR_LIGHTBLUE, WarnMessage);
}
return 1;
}
CMD:ban(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new id;
new tmp[256], tmp2[256], Index;
tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /ban [id/name] [reason]"); //Check If Player Does Not Added "Reason and the ID"
if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick another admin!");
if(id==playerid)SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: You can not kick yourself!");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp); // << player1 = ID of The Player
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Error: Player is not connected!"); //<< Check If Player Connected Or Not
GetPlayerName(player1, playername, sizeof(playername)); //get Selected Player Name
GetPlayerName(playerid, adminname, sizeof(adminname)); //get Admin Name Who Use This command
format(string,sizeof(string),"Administrator %s has banned %s | Reason ( %s )",adminname,playername,params[2]); //adminname = the player Who Use This command || playername = the Player who Going To Be kicked || params[2] = The Reason Of The Kick
SendClientMessageToAll(COLOR_LIGHTBLUE,string); // Send Message To all Players.
Ban(player1);
}
else return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You're not authorized to use this command!"); // This Code return the Player IF he's not Login in as RCON admin
return 1;
}
CMD:rangeban(playerid, params[]) {
new id;
new reason[50];
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
if(sscanf(params, "us[50]", id,reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[USAGE] - /rangeban [ID] [REASON]");
if(PlayerInfo[id][pAdmin] == 7) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "* One does not simply range-ban the server owner!");
new string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(id, receiver, sizeof(receiver));
//new rbandate[3];
//getdate(rbandate[0], rbandate[1], rbandate[2]);
format(string, sizeof(string), "[BAN] - %s(%d) has been banned by %s(%d)", receiver, id, sender, playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE, string); //Sends the kick message, as seen above ^.
format(string, sizeof(string), "[BAN] - Reason: %s", reason);
SendClientMessageToAll(COLOR_LIGHTBLUE, string); //Sends the kick reasons message, as seen above ^
SetTimerEx("KickTimer", 500, false, "i", id); //Sets KickTimer to 1 seond(will be kicked after 1 second)
PlayerInfo[id][pBanned] = 1;
SendClientMessage(id, COLOR_LIGHTBLUE, "[BAN] - You've been BANNED"); //Sends Target a message, saying that he was kicked.
SendClientMessage(id, COLOR_LIGHTBLUE, "[BAN] - For more info read the chat.");
//{FFFFFF}%s\n\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}Press F8 to take a screenshot and use this in unban appeal!", pname, playerid,Reason, rbandate[2], rbandate[1], rbandate[0]);
new ip[50];
GetPlayerIp(id,ip,sizeof(ip));
strdel(ip,strlen(ip)-4,strlen(ip));
format(ip,sizeof(ip),"%s**.**",ip);
format(ip,sizeof(ip),"banip %s",ip);
SendRconCommand(ip);
printf("ADMIN %s has RANGE BANNED %s FOR: %s", sender, receiver, reason);
new INI:File = INI_Open(UserPath(id));
INI_SetTag(File,"ban info");
INI_WriteString(File,"RANGE-Banned By", sender);
INI_WriteString(File,"Reason", reason);
INI_Close(File);
return 1;
}
CMD:announce(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /announce [message]");
return 1;
}
format(string, sizeof(string), "%s", params);
GameTextForAll(string, 5000, 0);
return 1;
}
CMD:spec(playerid, params[])
{
new ID;
new pname[128];
GetPlayerName(ID, pname, sizeof(pname));
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
if(sscanf(params, "i", ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /spec (playerid)");
return 1;
}
if(!IsPlayerConnected(ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Invalid player ID");
return 1;
}
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, ID);
SetPlayerInterior(playerid, ID);
SetPlayerInterior(playerid, GetPlayerInterior(ID));
IsSpectating[playerid] =1;
return 1;
}
CMD:specoff(playerid, params[])
{
#pragma unused params
if(IsSpectating[playerid] == 1)
{
TogglePlayerSpectating(playerid, 0);
IsSpectating[playerid] =0;
return 1;
}
return 1;
}
CMD:goto(playerid, params[])
{
new string[128];
new ID;
new pname[128];
GetPlayerName(ID, pname, sizeof(pname));
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
if(sscanf(params, "i", ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /goto (playerid)");
return 1;
}
if(!IsPlayerConnected(ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "That player ID is not connected.");
return 1;
}
new Float:x, Float:y, Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x+1,y,z);
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
SetPlayerInterior(playerid,GetPlayerInterior(ID));
format(string, sizeof(string), "You have teleported to %s(%d)", pname, ID);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
CMD:bring(playerid, params[])
{
new string[128];
new ID;
new pname[128];
GetPlayerName(ID, pname, sizeof(pname));
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
if(sscanf(params, "i", ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /bring (playerid)");
return 1;
}
if(!IsPlayerConnected(ID))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Invalid player ID");
return 1;
}
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(ID, x+1, y, z);
SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid));
SetPlayerInterior(ID, GetPlayerInterior(playerid));
format(string, sizeof(string), "You have brought %s(%d) to you.", pname, ID);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
CMD:setscore(playerid, params[])
{
new id, score;
if(sscanf(params, "ud", id, score) ) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /setscore [id] [score]");
if(PlayerInfo[playerid][pAdmin] < 5)SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You set the score");
SetPlayerScore(id, score);
return 1;
}
COMMAND:clearchat(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
for(new i = 0; i < 250; i++) SendClientMessageToAll(0x00000000," ");
return 1;
}
CMD:setmoney(playerid, params[])
{
new id, cash;
if(sscanf(params, "ud", id, cash) ) return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "Usage: /setcash [id] [cash]");
if(PlayerInfo[playerid][pAdmin] < 5)SendClientMessage(playerid, -COLOR_LIGHTBLUE, "You're not authorized to use this command!");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You set the cash");
GivePlayerMoney(id, cash);
return 1;
}
COMMAND:explode(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
new Float:x,Float:y,Float:z,id;
if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /explode [playerid]");
GetPlayerPos(id,x,y,z);
CreateExplosion(x,y,z,6,50.0);
return 1;
}
COMMAND:sethp(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
new id,Float:health;
if(sscanf(params,"uf",id,health)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: /sethp [playerid] [hp]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Player not found!");
SetPlayerHealth(id,health);
return 1;
}
COMMAND:setarmor(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
new id,Float:ar;
if(sscanf(params,"uf",id,ar)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: /setarmor [playerid] [armour]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Player not found!");
SetPlayerArmour(id,ar);
return 1;
}
COMMAND:makeadmin(playerid,params[])
{
if(!IsPlayerAdmin(playerid))SendClientMessage(playerid,COLOR_LIGHTBLUE,"You must be rcon admin to use this command");
new id,level,string[128];
if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: /makeadmin [playerid] [level 1-5]");
if(level > 7) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: Choose a level beetwen 0-5");
format(string,sizeof(string),"You have been PROMOTED to admin level %i",level);
SendClientMessage(id,COLOR_LIGHTBLUE,string);
PlayerInfo[id][pAdmin] = level;
return 1;
}
CMD:ip(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
new id,a[16];
new string[128];
if(sscanf(params, "u", id))return SendClientMessage(playerid, -COLOR_LIGHTBLUE, "Usage: /ip [playerid]");
if(IsPlayerConnected(id))
{
GetPlayerIp(id, a, sizeof(a));
format(string,sizeof(string),"This player IP is : %s",a);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
return GameTextForPlayer(playerid,"~w~you have checked player ip",3000,1);
}
else return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Player is not connected!");
}
CMD:acmds(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You're not authorized to use this command!");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Critical DM admin commands list!");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[STATISTICS] /ban /rangeban /setscore /setmoney");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PLAYER] /warn /kick /spec /specoff /goto /bring /explode");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PLAYER] /sethp /setarmor /ip");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PUBLIC] /announce /asay /clearchat /makeadmin");
return 1;
}
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFAA, "You have successfully killed yourself");
return 1;
}
CMD:cmds(playerid, params[])
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[SERVER] /admins /stats /kill /rules /lobby /startstunt /teleports");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[PLAYER] /afk /back /weaps /ask /report");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"More commands coming soon!");
return 1;
}
CMD:rules(playerid,params[])
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"------------------------");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[RULES] No insulting");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[RULES] No arguing");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[RULES] Respect the admins and players");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[RULES] Do not ask to be admin");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[RULES] Have fun and enjoy");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"------------------------");
return 1;
}
CMD:ask(playerid,params[])
{
new str[80];
if(sscanf(params,"s[80]",str)) SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage : /ask [HELP]");
new name[MAX_PLAYER_NAME],msg[110];
GetPlayerName(playerid,name,20);
format(msg,sizeof(msg),"[HELP]%s(%d) : %s",name,playerid,str);
for(new i=0;i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i) && (PlayerInfo[i][pAdmin] >0 || IsPlayerAdmin(i)))
SendClientMessage(i,-COLOR_LIGHTBLUE,msg);
}
return 1;
}
COMMAND:asay(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You're not authorized to use this command!");
new text[128];
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /asay[text]");
foreach(new i: Player)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
new string[64];
format(string,sizeof(string),"%s",text);
SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
}
return 1;
}
COMMAND:admins(playerid,params[])
{
new count = 0;
new string[128];
new AdminRank[128];
SendClientMessage(playerid,COLOR_LIGHTBLUE,"");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"________________|ONLINE ADMINS|________________");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
if(PlayerInfo[i][pAdmin] == 1)
{
AdminRank = "Helper";
}
else if(PlayerInfo[i][pAdmin] == 2)
{
AdminRank = "Moderator";
}
else if(PlayerInfo[i][pAdmin] == 3)
{
AdminRank = "Administrator";
}
else if(PlayerInfo[i][pAdmin] == 4)
{
AdminRank = "HR Manager";
}
else if(PlayerInfo[i][pAdmin] == 5)
{
AdminRank = "Server Owner";
}
new aName[MAX_PLAYER_NAME];
GetPlayerName(i,aName,sizeof(aName));
format(string, sizeof(string), "Level: %d | Name: %s (ID:%i) | Rank: %s ", PlayerInfo[i][pAdmin], aName,i,AdminRank);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
count++;
}
}
}
if(count == 0)
SendClientMessage(playerid,COLOR_LIGHTBLUE,"No Admins online!");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"_________________________________________________");
return 1;
}
CMD:stats(playerid, params[])
{
new str[1000];
#define DIALOG_STATS 1997
format(str, sizeof(str), "Admin: %d\nKills: %d\nDeaths: %d\nCash: %d\nScore: %d", PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX , "STATS", str, "CLOSE", "");
return 1;
}
CMD:report(playerid, params[])
{
new id, reason[60];
new string[256], Reporter[MAX_PLAYER_NAME];
new Target[MAX_PLAYER_NAME];
if(sscanf(params, "us[60]", id, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage:/report (playerid/partofname) (reason)");
if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_LIGHTBLUE, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
GetPlayerName(playerid, Reporter, sizeof(Reporter));
GetPlayerName(id, Target, sizeof(Target));
format(string, sizeof(string),"Player'%s reported Player'%s. Reason:%s.",Reporter,Target,reason);
ReportMessage(string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have sent your report's to an Online Admin!");
return 1;
}
CMD:weaps(playerid, params[])
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Deagle - /deagle - gives you a weapon (Deagle)");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Combat shotgun - /combat - gives you a weapon (SPAS 12)");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"M4 - /m4 - gives you a weapon (M4)");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Tec-9 - /tec9 - gives you a weapon (TEC-9)");
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Sniper - /sniper - gives you a weapon (SNIPER)");
return 1;
}
CMD:deagle(playerid, params[])
{
GivePlayerWeapon(playerid,24,500);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have recieved a weaponary");
return 1;
}
CMD:combat(playerid, params[])
{
GivePlayerWeapon(playerid,27,500);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have recieved a weaponary");
return 1;
}
CMD:m4(playerid, params[])
{
GivePlayerWeapon(playerid,31,500);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have recieved a weaponary");
return 1;
}
CMD:tec9(playerid, params[])
{
GivePlayerWeapon(playerid,32,500);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have recieved a weaponary");
return 1;
}
CMD:sniper(playerid, params[])
{
GivePlayerWeapon(playerid,34,500);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have recieved a weaponary");
return 1;
}
LoadPlayerTextDraws(playerid)
{
ConnectTD[0] = CreatePlayerTextDraw(playerid,-11.000000, 342.000000, "-");
PlayerTextDrawBackgroundColor(playerid,ConnectTD[0], 255);
PlayerTextDrawFont(playerid,ConnectTD[0], 1);
PlayerTextDrawLetterSize(playerid,ConnectTD[0], 0.500000, 16.200000);
PlayerTextDrawColor(playerid,ConnectTD[0], -1);
PlayerTextDrawSetOutline(playerid,ConnectTD[0], 0);
PlayerTextDrawSetProportional(playerid,ConnectTD[0], 1);
PlayerTextDrawSetShadow(playerid,ConnectTD[0], 1);
PlayerTextDrawUseBox(playerid,ConnectTD[0], 1);
PlayerTextDrawBoxColor(playerid,ConnectTD[0], 180);
PlayerTextDrawTextSize(playerid,ConnectTD[0], 692.000000, 32.000000);
PlayerTextDrawSetSelectable(playerid,ConnectTD[0], 0);
ConnectTD[1] = CreatePlayerTextDraw(playerid,-12.000000, 339.000000, "-");
PlayerTextDrawBackgroundColor(playerid,ConnectTD[1], 255);
PlayerTextDrawFont(playerid,ConnectTD[1], 1);
PlayerTextDrawLetterSize(playerid,ConnectTD[1], 0.500000, 0.000000);
PlayerTextDrawColor(playerid,ConnectTD[1], -1);
PlayerTextDrawSetOutline(playerid,ConnectTD[1], 0);
PlayerTextDrawSetProportional(playerid,ConnectTD[1], 1);
PlayerTextDrawSetShadow(playerid,ConnectTD[1], 1);
PlayerTextDrawUseBox(playerid,ConnectTD[1], 1);
PlayerTextDrawBoxColor(playerid,ConnectTD[1], -6750038);
PlayerTextDrawTextSize(playerid,ConnectTD[1], 692.000000, 42.000000);
PlayerTextDrawSetSelectable(playerid,ConnectTD[1], 0);
ConnectTD[2] = CreatePlayerTextDraw(playerid,-11.000000, -49.000000, "-");
PlayerTextDrawBackgroundColor(playerid,ConnectTD[2], 255);
PlayerTextDrawFont(playerid,ConnectTD[2], 1);
PlayerTextDrawLetterSize(playerid,ConnectTD[2], 0.500000, 16.200000);
PlayerTextDrawColor(playerid,ConnectTD[2], -1);
PlayerTextDrawSetOutline(playerid,ConnectTD[2], 0);
PlayerTextDrawSetProportional(playerid,ConnectTD[2], 1);
PlayerTextDrawSetShadow(playerid,ConnectTD[2], 1);
PlayerTextDrawUseBox(playerid,ConnectTD[2], 1);
PlayerTextDrawBoxColor(playerid,ConnectTD[2], 180);
PlayerTextDrawTextSize(playerid,ConnectTD[2], 692.000000, 32.000000);
PlayerTextDrawSetSelectable(playerid,ConnectTD[2], 0);
ConnectTD[3] = CreatePlayerTextDraw(playerid,-12.000000, 100.000000, "-");
PlayerTextDrawBackgroundColor(playerid,ConnectTD[3], 255);
PlayerTextDrawFont(playerid,ConnectTD[3], 1);
PlayerTextDrawLetterSize(playerid,ConnectTD[3], 0.500000, 0.000000);
PlayerTextDrawColor(playerid,ConnectTD[3], -1);
PlayerTextDrawSetOutline(playerid,ConnectTD[3], 0);
PlayerTextDrawSetProportional(playerid,ConnectTD[3], 1);
PlayerTextDrawSetShadow(playerid,ConnectTD[3], 1);
PlayerTextDrawUseBox(playerid,ConnectTD[3], 1);
PlayerTextDrawBoxColor(playerid,ConnectTD[3], -6750038);
PlayerTextDrawTextSize(playerid,ConnectTD[3], 692.000000, 42.000000);
PlayerTextDrawSetSelectable(playerid,ConnectTD[3], 0);