-
Notifications
You must be signed in to change notification settings - Fork 1
/
zombiemod-mysql.sma
3671 lines (3499 loc) · 100 KB
/
zombiemod-mysql.sma
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 <amxmodx>
#include <amxmisc>
#include <engine>
#include <engine_stocks>
#include <tsfun>
#include <tsx>
#include <fakemeta>
#include <fun>
#include <dbi>
#define FACTORTIME 60
/*
new tsweaponammo[38] = {0,17,15,32,7,30,30,30,15,12,12,20,7,30,20,30,32,20,5,40,8,16,15,25,1,25,8,18,17,0,20,5,100,2,1,1,1,20}
new tsweaponid[38][32] = {"Kung Fu","Glock 18","Beretta 92F","Mini-Uzi","Benelli M3","M4A1","MP5SD","MP5K","Beretta 92F","SOCOM-MK23","SOCOM-MK23","USAS-12","Desert Eagle","AK47","Five-seveN","STEYR-AUG","Mini-Uzi","Skorpion","Barrett M82A1","MP7-PDW","SPAS-12","Golden Colts","Glock-20C","UMP","M61 Grenade","Combat Knife","Mossberg 500","M16A4","Ruger-MK1","Kung Fu","Five-seveN","Raging Bull","M60E3","Sawed-off","Katana","Seal Knife","Contender G2","Skorpion"
new tsweapontype[38] = {0,1,1,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
// weapontype 0 = Melee
// 1 = Pistol
// 2 = Sub-Machine
// 3 = Rifle
// 4 = Shotgun
*/
new thirdperson[33]
new globalfmt[33][180]
new timefactor=0;
//new currentfactor=0;
new playersfactor[34]=0;
//playersfactor[i] = id
new hisfactor[33];
new nemesis = 0
public findavailable(id)
{
new lol2 = (get_maxplayers()-get_cvar_num("sv_addbots"))
for(new i=1;i<lol2;i++)
{
if(!playersfactor[i])
{
playersfactor[i]=id
return i
}
}
return 5
}
new discounter = 0;
// Avalanches Ammo Code (Thanks for letting me use it // Set a user's ammo amount
public ts_setuserammo(id,weapon,ammo) {
// Kung Fu
if(weapon == 36) {
client_cmd(id,"weapon_0"); // switch to kung fu
return 0; // stop now
}
// Invalid Weapong
if(weapon < 0 || weapon > 35) {
return 0; // stop now
}
client_cmd(id,"weapon_%d",weapon); // switch to whatever weapon
// C4 or Katana
if(weapon == 29 || weapon == 34) {
return 0; // stop now
}
// TS AMMO OFFSETS
new tsweaponoffset[36];
tsweaponoffset[1] = 50;
tsweaponoffset[3] = 50;
tsweaponoffset[4] = 52;
tsweaponoffset[5] = 53;
tsweaponoffset[6] = 50;
tsweaponoffset[7] = 50;
tsweaponoffset[8] = 50;
tsweaponoffset[9] = 51;
tsweaponoffset[10] = 51;
tsweaponoffset[11] = 52;
tsweaponoffset[12] = 54;
tsweaponoffset[13] = 53;
tsweaponoffset[14] = 56;
tsweaponoffset[15] = 53;
tsweaponoffset[16] = 50;
tsweaponoffset[17] = 50;
tsweaponoffset[18] = 57;
tsweaponoffset[19] = 56;
tsweaponoffset[20] = 52;
tsweaponoffset[21] = 51;
tsweaponoffset[22] = 58;
tsweaponoffset[23] = 51;
tsweaponoffset[24] = 354;
tsweaponoffset[25] = 366;
tsweaponoffset[26] = 52;
tsweaponoffset[27] = 53;
tsweaponoffset[28] = 59;
tsweaponoffset[30] = 56;
tsweaponoffset[31] = 61;
tsweaponoffset[32] = 53;
tsweaponoffset[33] = 52;
tsweaponoffset[35] = 486;
new currentent = -1, tsgun = 0; // used for getting user's weapon_tsgun
// get origin
new Float:origin[3];
entity_get_vector(id,EV_VEC_origin,origin);
// loop through "user's" entities (whatever is stuck to user, basically)
while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0) {
new classname[32];
entity_get_string(currentent,EV_SZ_classname,classname,31);
if(equal(classname,"weapon_tsgun")) { // Found weapon_tsgun
tsgun = currentent; // remember it
}
}
// Couldn't find weapon_tsgun
if(tsgun == 0) {
return 0; // stop now
}
// Get some of their current settings
new currclip, currammo, currmode, currextra;
ts_getuserwpn(id,currclip,currammo,currmode,currextra);
set_pdata_int(tsgun,tsweaponoffset[weapon],ammo); // set their ammo
// Grenade or knife, set clip
if(weapon == 24 || weapon == 25 || weapon == 35) {
set_pdata_int(tsgun,41,ammo); // special clip storage
set_pdata_int(tsgun,839,ammo); // more special clip storage
currclip = ammo; // change what we send to WeaponInfo
ammo = 0; // once again, change what we send to WeaponInfo
}
else { // Not a grenade or knife, set ammo
set_pdata_int(tsgun,850,ammo); // special ammo storage
}
// Update user's HUD
message_begin(MSG_ONE,get_user_msgid("WeaponInfo"),{0,0,0},id);
write_byte(weapon);
write_byte(currclip);
write_short(ammo);
write_byte(currmode);
write_byte(currextra);
message_end();
return 1; // wooh!
}
public set_entity_health(door,Float:hp)
{
if(hp == -1.0) {
entity_set_float(door,EV_FL_max_health,99999.0)
entity_set_float(door,EV_FL_health,99999.0)
entity_set_float(door,EV_FL_dmg,0.0)
entity_set_float(door,EV_FL_takedamage,0.0)
return 1
}
entity_set_float(door,EV_FL_max_health,hp)
entity_set_float(door,EV_FL_health,hp)
return 1
}
// The actual creating process
// Creating Ambients
public create_ambient(porigin[3],targetname[],vol[],pitch[],spawnflags,file[])
{
new ambient = create_entity("ambient_generic")
if(!ambient) return 0
entity_set_string(ambient,EV_SZ_classname,"ambient_generic")
entity_set_int(ambient,EV_INT_spawnflags,spawnflags)
entity_set_float(ambient,EV_FL_health,10.0)
entity_set_string(ambient,EV_SZ_targetname,targetname)
entity_set_string(ambient,EV_SZ_message,file)
DispatchKeyValue(ambient,"pitch",pitch)
DispatchKeyValue(ambient,"volstart",vol)
DispatchKeyValue(ambient,"pitchstart",pitch)
DispatchSpawn(ambient)
new Float:origin[3]
origin[0] = float(porigin[0])
origin[1] = float(porigin[1])
origin[2] = float(porigin[2])
entity_set_origin(ambient,origin)
return ambient;
}
new line[33]
new Sql:dbc
new Result:result
stock explode( output[][], input[], delimiter)
{
new nIdx = 0
new iStringSize
while ( input[iStringSize] )
iStringSize++
new nLen = (1 + copyc( output[nIdx], iStringSize-1, input, delimiter ))
while( nLen < strlen(input) )
nLen += (1 + copyc( output[++nIdx], iStringSize-1, input[nLen], delimiter ))
return nIdx + 1
}
public is_user_database(steamid[]) {
new query[256]
format(query,255,"SELECT level FROM users WHERE steamid = '%s'",steamid)
result = dbi_query(dbc,query)
if( dbi_nextrow( result ) > 0 ) return 1
dbi_free_result(result)
return 0
}
#define skillfactor 10000
#define lowlevel 1
#define mediumlevel 10
#define highlevel 20
#define ultimatelevel 28
new g_level[33]
new exp[33]
new slots[33]
new curslots[33]
new zombie[33]
new Float:newspeed[33]
new Float:oldspeed[33]
new frags[33]
// RADIO MOD
/*new radio
new notdone[33]
new currentsong[33]
new wow[10][64]
new wow2[10][32]*/
// RADIO MOD
//
new lastorig[33][3]
new killsinspot[33]
new lastexp[33]
new heightcheck[33]
//
new objective[33][64]
new objectivedone[33] = 0
new objectivereward[33] = 0
new speed[33]
new gravity[33]
new glow[33]
new special[33]
new rerate[33]
new curspeed[33]
new curgravity[33]
// Weapons
new laser[33] = 0
new silencer[33] = 0
new scope[33] = 0
new flashlight[33] = 0
new added[33] = 0
new ztype[33] = 0;
/*
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string("^x03Team colored text ^x01Normal color")
message_end()
*/
new lightning
public plugin_precache()
{
precache_model("models/player/collector-zombie/collector-zombie.mdl")
precache_model("models/player/collector-zombie/collector-zombie.mdl")
//precache_model("models/rdm_chnvase.mdl")
precache_sound("ambience/thunder_clap.wav")
lightning = precache_model("sprites/lgtning.spr")
new szFilename[64] = "radio.ini"
if(!file_exists(szFilename)) return PLUGIN_HANDLED
/* new szText[256]
new a, pos = 0,lol = 0
while ( read_file(szFilename,pos++,szText,255,a) && lol < 10 )
{
if(equal(szText,"") || equal(szText," ") || szText[0] == ';') continue;
new file[2][64]
explode(file,szText,'*')
precache_sound(file[0])
wow[lol] = file[0]
format(wow2[lol],31,file[1])
lol++
}*/
return PLUGIN_HANDLED
}
new entz;
new entz2;
new const g_lights[25][2] = { "a", "a", "a", "a", "a", "b", "c", "d", "e", "f", "g", "h", "h", "h", "h", "h", "h", "h", "h", "f", "d", "a", "a", "a", "a" };
new const g_fog[25] = {0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0};
new const g_onlight[25] = {1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}
new g_internal_hour;
new dolights=0;
new lighton=1;
public plugin_init() {
register_plugin("Zombie Mod","v1.596","StevenlAFl")
register_concmd("amx_setfrags","setfrags",ADMIN_CVAR,"<name> <frags>")
register_concmd("amx_invis","amx_invis",ADMIN_CFG,"<name> <0/1>")
register_concmd("amx_noclip","amx_noclip",ADMIN_BAN,"<name> <1/0>")
register_concmd("amx_forceuse","useany",ADMIN_CFG,"<entid>")
register_concmd("amx_ssay","amx_ssay",ADMIN_CHAT,"<message>")
register_concmd("amx_alldropweapons","domayhem",ADMIN_IMMUNITY,"")
register_concmd("amx_giveweapon","amx_giveweapon",ADMIN_CFG,"<name> <weaponid> <clips> <flags>")
register_concmd("amx_givepwup","givepwup",ADMIN_CFG,"<name> <pwupid>")
register_concmd("amx_execclient","execclient",ADMIN_BAN,"<name/steamid/#id> <command>")
register_concmd("amx_execall","execall",ADMIN_BAN,"<command> <flags>")
register_concmd("amx_createspawn","addspawn",ADMIN_IMMUNITY,"<weaponid> <extraclips> <spawnflags>")
register_concmd("amx_lookup","lookup",ADMIN_ADMIN,"<name>")
register_concmd("amx_zombiemassacre","zombiemassacre",ADMIN_IMMUNITY,"")
register_concmd("amx_setcash","amx_setcash",ADMIN_CFG,"<name> <cash>")
register_concmd("amx_setlevel","amx_setlevel",ADMIN_CVAR,"<name> <level>")
register_concmd("amx_setexp","amx_setexp",ADMIN_CVAR,"<name> <level>")
register_concmd("set_user_rendering","rendering",ADMIN_CVAR,"<r> <g> <b> <fx> <render> <amount>")
register_concmd("amx_setmodel","setmodel",ADMIN_RCON,"")
register_forward(FM_GetGameDescription,"GameDesc");
/* register_clcmd("say /weapon", "defaultgun", 0, "Spawns player a random gun")
register_clcmd("say /laser", "laserer", -1)
register_clcmd("say /flashlight", "flashlighter", -1)
register_clcmd("say /silencer", "silencerer", -1)
register_clcmd("say /scope", "scoper", -1)
register_clcmd("say /ruger", "ruger", -1)
register_clcmd("say /deagle", "deagle", -1)
register_clcmd("say /socom", "socom", -1)
register_clcmd("say /akimbos", "akimbo", -1)
register_clcmd("say /colts", "colts", -1)
register_clcmd("say /fiveseven", "fiveseven", -1)
register_clcmd("say /glock18", "glock18", -1)
register_clcmd("say /glock20c", "glock20c", -1)
register_clcmd("say /pistol", "randompistol", -1)
register_clcmd("say /resetflags", "resetflags", -1)
register_clcmd("say /m3", "givem3", -1)
register_clcmd("say /uzi", "uzis", -1)
register_clcmd("say /ak47", "ak47", -1)
register_clcmd("say /m4a1", "m4a1", -1)
register_clcmd("say /autoshottie", "autoshottie", -1)
register_clcmd("say /mp5sd", "mp5sd", -1)
register_clcmd("say /mp5k", "mp5k", -1)
register_clcmd("say /barret", "barret", -1)
register_clcmd("say /m60", "m60", -1)
register_clcmd("say /ragingbull", "ragingbull", -1)
register_clcmd("say /grenade", "grenade", -1)
register_clcmd("say /motd", "motd", -1)
register_clcmd("say /resetexp", "resetexp", -1)
register_clcmd("say /help", "help", -1)
register_clcmd("say /ammo", "ammo", -1)
register_clcmd("say /m16", "m16", -1)
register_clcmd("say /sawedoff", "sawedoff", -1)
register_clcmd("say /aug", "aug", -1)
register_clcmd("say /spas12", "spas12", -1)
register_clcmd("say /katana", "katana", -1)
register_clcmd("say /knife", "knife", -1)
register_clcmd("say /seal", "seal", -1)
register_clcmd("say /mossberg", "mossberg", -1)
register_clcmd("say /tmp", "tmp", -1)
register_clcmd("say /mac10","mac10",-1)
register_clcmd("say /mp7","mp7",-1)
register_clcmd("say /showoff", "showoff", -1)
register_clcmd("say /speed", "speedup",-1)
register_clcmd("say /createradio", "createradio",-1)
register_clcmd("say /setradio", "setradio",-1)
register_clcmd("say /removeradio", "removeradio",-1)
register_clcmd("say /radiomenu", "showMenuradio",-1)
register_clcmd("say /weaponsmenu","showMenuWeapons",-1)
register_clcmd("say /riflemenu","showMenuRifle",-1)
register_clcmd("say /submachinemenu","showMenuSub",-1)
register_clcmd("say /pistolmenu","showMenuPistol",-1)
register_clcmd("say /heavymenu","showMenuHeavy",-1)
register_clcmd("say /ztop","ztop",-1)
//register_clcmd("say /gravity", "gravup",-1)*/
register_clcmd("say","handle_say",-1);
register_srvcmd("spawn_nemesis","nemesis2")
register_srvcmd("set_objective","amx_objective")
register_srvcmd("set_objectivestatus","amx_objectivestatus")
register_srvcmd("amx_addmessage","addmessage")
register_srvcmd("amx_removemessage","removemessage")
register_cvar("zombiemod_mysql_host","127.0.0.1",FCVAR_PROTECTED)
register_cvar("zombiemod_mysql_user","root",FCVAR_PROTECTED)
register_cvar("zombiemod_mysql_pass","",FCVAR_PROTECTED)
register_cvar("zombiemod_mysql_db","zombiemod",FCVAR_PROTECTED)
register_cvar("usersfile","users.ini")
register_cvar("sv_addbots","20")
register_cvar("sv_expdivision","6.0");
register_cvar("sv_expmultiplication","2.0");
register_cvar("sv_remove_groundweapon","0")
register_cvar("sv_remove_doors","0")
register_cvar("sv_remove_breakable","0")
register_cvar("sv_remove_train","0")
register_cvar("sv_remove_button","0")
register_cvar("sv_remove_powerup","0")
register_cvar("hud_pos_x","-1.9") // X Position of ZombieMod on players screen
register_cvar("hud_pos_y","0.55") // Y Position of ZombieMod on players screen
register_cvar("hud_red","0") // Hud Colors
register_cvar("hud_green","175")
register_cvar("hud_blue","0")
register_cvar("info_hud_pos_x","0.45") // X Position of info on players screen
register_cvar("info_hud_pos_y","0.84") // Y Position of info on players screen
register_cvar("info_hud_red","200") // Hud Colors
register_cvar("info_hud_green","200")
register_cvar("info_hud_blue","200")
register_cvar("sv_grammar","1")
//register_cvar("sv_radio","0")
register_cvar("sv_playerzombie_hp","300")
register_cvar("sv_computerzombie_hp","100")
register_cvar("sv_player_hp","100");
register_cvar("sv_zombieknife","0")
register_cvar("sv_parasite","0")
register_cvar("sv_nemesis","1")
register_cvar("sv_zombie_throwknives","0")
register_cvar("sv_player_throwknives","1")
register_cvar("sv_campingprotection","1")
register_cvar("sv_campingstrikedown","1")
register_cvar("sv_useslots","1")
register_cvar("sv_superjump","1")
register_cvar("sv_kungfu","1")
register_cvar("sv_useopen","1")
register_statsfwd(XMF_DAMAGE)
register_forward(FM_SetClientMaxspeed, "forward_SetClientMaxspeed")
register_event("DeathMsg","death_msg","a")
register_event("ResetHUD","spawn_msg", "be")
register_event("WeaponInfo", "event_WeaponInfo", "b")
register_menucmd(register_menuid("Category"),1023,"actionMenuweapons")
register_menucmd(register_menuid("Pistols"),1023,"actionMenuPistol")
register_menucmd(register_menuid("Sub-Machine Guns"),1023,"actionMenuSub")
register_menucmd(register_menuid("Shotguns"),1023,"actionMenuShotgun")
register_menucmd(register_menuid("Rifles"),1023,"actionMenuRifle")
register_menucmd(register_menuid("Heavy Weapons"),1023,"actionMenuHeavy")
//register_menucmd(register_menuid("Radio Mod"),1023,"actionradio")
//Section to have cvars for weapons
register_cvar("sv_deagle_level","1")
register_cvar("sv_socom_level","1")
register_cvar("sv_beretta_level","1")
register_cvar("sv_colts_level","1")
register_cvar("sv_glock18_level","1")
register_cvar("sv_glock20c_level","1")
register_cvar("sv_fiveseven_level","1")
register_cvar("sv_ruger_level","1")
register_cvar("sv_m3_level","1")
register_cvar("sv_uzis_level","1")
register_cvar("sv_aug_level","4")
register_cvar("sv_spas12_level","2")
register_cvar("sv_mossberg_level","4")
register_cvar("sv_katana_level","1")
register_cvar("sv_ump_level","2")
register_cvar("sv_mp7_level","3")
register_cvar("sv_m16_level","4")
register_cvar("sv_ak47_level","3")
register_cvar("sv_m4a1_level","5")
register_cvar("sv_barret_level","9")
register_cvar("sv_mp5sd_level","2")
register_cvar("sv_mp5k_level","2")
register_cvar("sv_ragingbull_level","12")
register_cvar("sv_m60_level","9")
register_cvar("sv_sawedoff_level","2")
register_cvar("sv_grenade_level","12")
register_cvar("sv_autoshottie_level","7")
register_cvar("sv_skorpion_level","7")
register_cvar("sv_contender_level","18")
register_cvar("sv_pistol_level","1")
register_cvar("sv_smg_level","1")
register_cvar("sv_shotgun_level","1")
register_cvar("sv_rifle_level","1")
register_cvar("sv_grenade_timer","120");
set_objective(0,"Kill 50 zombies",150)
set_task(2.0,"lologram")
set_task(2.0,"hudmsg",0,"",0,"b")
set_task(1.0,"info_hud_show",0,"",0,"b")
set_task(1.0,"setcolors",0,"",0,"b")
set_task(0.25,"seelevels",0,"",0,"b")
set_task(5.0,"recharge",0,"",0,"b")
//set_task(30.0,"saveall",0,"",0,"b")
set_task(360.0,"nemesis2",0,"",0,"b")
set_task(1.0,"sql_init")
set_msg_block(122,1) //round time
set_msg_block(66,1) //selammo
set_msg_block(90,1) //hideweapon
set_msg_block(82,1) // teaminfo
new map[64]
get_mapname(map,63)
server_print("%s",map)
if(equali(map,"MecklenburgV_SnowFinal"))
{
server_print("yes")
set_task( 30.0, "advance_light", g_internal_hour, "", 0, "b" );
dolights = 1;
}
format(map,63,"map %s",map)
if(containi(map, "ts_") != -1)
write_file("crashed.cfg",map,0)
new configsDir[64]
get_configsdir(configsDir, 63)
server_cmd("exec %s/ZombieMod/zombiemod_config.cfg",configsDir)
}
public GameDesc()
{
forward_return(FMV_STRING,"Zombie DM");
return FMRES_SUPERCEDE;
}
new infomessage[33][3][128]
new msgnum[33] = 0;
new waitm[33] = 0;
public info_add_msg(id,message[]) {
msgnum[id]++
if(msgnum[id] == 3)
{
msgnum[id] = 2;
infomessage[id][0] = infomessage[id][1]
infomessage[id][1] = infomessage[id][2]
}
for(new i = 0;i < 3;i++)
{
if(equal(infomessage[id][i], ""))
{
msgnum[id] = i
break;
}
}
client_print(id, print_console, "%s",message)
format(infomessage[id][msgnum[id]],128,"%s",message)
info_hud_show(id,4)
return PLUGIN_HANDLED
}
public info_hud_show(id,lol) {
if(lol == 4)
{
waitm[id] = 0;
set_hudmessage(get_cvar_num("info_hud_red"),get_cvar_num("info_hud_green"),get_cvar_num("info_hud_blue"),get_cvar_float("info_hud_pos_x"),get_cvar_float("info_hud_pos_y"),0,0.0,99.9,0.0,0.0,3)
show_hudmessage( id, "%s^n%s^n%s",infomessage[id][0],infomessage[id][1],infomessage[id][2])
return PLUGIN_HANDLED
}
new num, players[32]
get_players(players,num,"c")
for( new i = 0; i < num; i++ )
{
waitm[players[i]]++
if(waitm[players[i]] == 2)
{
waitm[players[i]] = 0
infomessage[players[i]][0] = infomessage[players[i]][1]
infomessage[players[i]][1] = infomessage[players[i]][2]
infomessage[players[i]][2] = "";
}
set_hudmessage(get_cvar_num("info_hud_red"),get_cvar_num("info_hud_green"),get_cvar_num("info_hud_blue"),get_cvar_float("info_hud_pos_x"),get_cvar_float("info_hud_pos_y"),0,0.0,99.9,0.0,0.0,3)
show_hudmessage( players[i], "%s^n%s^n%s",infomessage[players[i]][0],infomessage[players[i]][1],infomessage[players[i]][2])
}
return PLUGIN_HANDLED
}
public forward_SetClientMaxspeed(id, Float:speed)
{
//static Float:f_zs, str_zs[8]
if(oldspeed[id] != 0.0 )
{
set_pev(id, pev_maxspeed, newspeed[id])
return FMRES_SUPERCEDE
}
/*if(get_user_team(id) == 2)
{
if(!is_user_bot(id))
{
}
return FMRES_SUPERCEDE
}*/
return FMRES_IGNORED
}
public event_WeaponInfo(id)
{
new curweapon = read_data(1)
if(get_user_team(id) == 2)
{
if(curweapon != 25 && curweapon != 34 && curweapon != 35)
if(is_user_bot(id))
{
if(id != nemesis) set_task(0.1, "delay_drop", id)
}
else
{
set_task(0.1, "delay_drop", id)//console_cmd(id, "drop")
}
}
}
public delay_drop(id)
{
engclient_cmd(id, "drop")
}
public setmodel(id,level,cid)
{
if (!cmd_access(id, level, cid, 7))
return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
if(str_to_num(arg) == 1)
{
set_entity_visibility(id,0)
//create_ent(id,"models/rdm_chnvase.mdl")
}
else
{
set_entity_visibility(id,1)
remove_ent(id)
}
return PLUGIN_HANDLED
}
public rendering(id,level,cid)
{
if (!cmd_access(id, level, cid, 7))
return PLUGIN_HANDLED
new fx,r,g,b,render,amount
new arg[32],arg2[32],arg3[32],arg4[32],arg5[32],arg6[32]
read_argv(1,arg,31)
read_argv(2,arg2,31)
read_argv(3,arg3,31)
read_argv(4,arg4,31)
read_argv(5,arg5,31)
read_argv(6,arg6,31)
fx = str_to_num(arg)
r = str_to_num(arg2)
g = str_to_num(arg3)
b = str_to_num(arg4)
render = str_to_num(arg5)
amount = str_to_num(arg6)
set_user_rendering(id, fx, r, g, b, render, amount);
return PLUGIN_HANDLED
}
new Float:expdiv=6.0;
new Float:expmult=2.0;
public handle_thirdperson(id)
{
if(!is_user_alive(id) || !glow[id] || zombie[id]) return PLUGIN_HANDLED
if(thirdperson[id])
{
thirdperson[id] = 0
if(glow[id] == 1) set_user_rendering(id,kRenderFxGlowShell,0,225,0,kRenderNormal,32)
else if(glow[id] == 2) set_user_rendering(id,kRenderFxGlowShell,0,0,225,kRenderNormal,32)
else if(glow[id] == 3) set_user_rendering(id,kRenderFxGlowShell,225,0,0,kRenderNormal,32)
else if(glow[id] == 4) set_user_rendering(id,kRenderFxGlowShell,225,0,225,kRenderNormal,32)
else if(glow[id] == 5) set_user_rendering(id,kRenderFxGlowShell,200,255,0,kRenderNormal,32)
else if(glow[id] == 6) set_user_rendering(id,kRenderFxGlowShell,225,225,225,kRenderNormal,32)
else if(glow[id] == 7) set_user_rendering(id,kRenderFxGlowShell,225,200,0,kRenderNormal,32)
//client_print(id,print_chat,"You started glowing again")
info_add_msg(id,"You started glowing again");
}
else
{
thirdperson[id] = 1
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,32)
//client_print(id,print_chat,"You are no-longer glowing")
info_add_msg(id,"You are no-longer glowing");
}
return PLUGIN_CONTINUE
}
public amx_setcash(id)
{
new lol[32]
read_argv(1,lol,31)
ts_setusercash(id,str_to_num(lol));
return PLUGIN_HANDLED
}
public mass2(id)
{
new origin[3],origin2[3]
get_user_origin(id,origin)
origin[2] += 500
origin[1] += random_num(-5,5)
origin[0] += random_num(-5,5)
get_user_origin(id,origin2)
basic_lightning(origin,origin2,10)
new num, players[32]
get_players(players,num,"c")
for( new i = 0; i < num; i++ )
{
emit_sound(players[i], CHAN_VOICE, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
set_lights("z")
set_task(0.1,"lightreset")
user_kill(id)
}
public zombiemassacre(id)
{
new Float:timez = 0.000000;
new num, players[32]
get_players(players,num,"ad")
for( new i = 0; i < num; i++ )
{
timez += 0.250000
set_task(timez,"mass2",players[i])
}
}
public lookup(id)
{
new arg[32]
read_argv(1,arg,31)
new targetid = cmd_target(id,arg,0)
if(!targetid) return PLUGIN_HANDLED
new name[32]
get_user_name(targetid,name,31)
client_print(id,print_console,"[ZombieDM] %s is level %i with %i experience",name,g_level[targetid],exp[targetid])
return PLUGIN_HANDLED
}
new glowcycle[33] = 0;
new lastz = 0;
public seelevels()
{
new num, players[32]
get_players(players,num,"c")
for( new i = 0; i < num; i++ )
{
if(!is_user_alive(players[i])) continue;
new tid, body
get_user_aiming( players[i], tid, body, 9999)
if(is_user_connected(tid))
{
if(!is_user_bot(tid))
{
if(glow[tid] == 1) set_hudmessage(0,225,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 2) set_hudmessage(0,0,225,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 3) set_hudmessage(225,0,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 4) set_hudmessage(225,0,225,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 5) set_hudmessage(200,255,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 6) set_hudmessage(225,225,225,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 7) set_hudmessage(225,200,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else if(glow[tid] == 8) set_hudmessage(100,52,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,1)
else set_hudmessage(0,225,0,-1.0,0.4,0,0.0,2.0,0.0,0.0,-1)
if(is_user_admin(tid)) show_hudmessage(players[i],"Admin")
else show_hudmessage(players[i],"Level %i",g_level[tid])
}
}
}
}
public setcolors()
{
//set_cvar_string("hostname","Zombie DM - www.l4drp.net")
lastz++
new num, players[32]
get_players(players,num,"c")
for( new i = 0; i < num; i++ )
{
if(hisfactor[players[i]] == lastz)
save(players[i])
if(!is_user_alive(players[i])) continue;
if(thirdperson[players[i]]) continue;
if(zombie[players[i]]) continue;
if(glow[players[i]] == 8)
{
glowcycle[players[i]] += 1
if(glowcycle[players[i]] == 8) glowcycle[players[i]] = 1
if(glowcycle[players[i]] == 1) set_user_rendering(players[i],kRenderFxGlowShell,0,225,0,kRenderNormal,32)
else if(glowcycle[players[i]] == 2) set_user_rendering(players[i],kRenderFxGlowShell,0,0,225,kRenderNormal,32)
else if(glowcycle[players[i]] == 3) set_user_rendering(players[i],kRenderFxGlowShell,225,0,0,kRenderNormal,32)
else if(glowcycle[players[i]] == 4) set_user_rendering(players[i],kRenderFxGlowShell,225,0,225,kRenderNormal,32)
else if(glowcycle[players[i]] == 5) set_user_rendering(players[i],kRenderFxGlowShell,200,255,0,kRenderNormal,32)
else if(glowcycle[players[i]] == 6) set_user_rendering(players[i],kRenderFxGlowShell,225,225,225,kRenderNormal,32)
else if(glowcycle[players[i]] == 7) set_user_rendering(players[i],kRenderFxGlowShell,225,200,0,kRenderNormal,32)
}
else if(glow[players[i]] == 9)
{
set_user_rendering(players[i],kRenderFxGlowShell,random_num(0,255),random_num(0,255),random_num(0,255),kRenderNormal,32)
}
}
if(dolights)
{
new fmt[32]
format(fmt,31,"gl_fog %i",g_fog[g_internal_hour])
for(new i=0;i<=get_maxplayers();i++)
{
if(!is_user_connected(i)) continue;
client_cmd(i,fmt)
/*if(get_user_frags(i) > 0)
{
set_user_frags(i,0)
message_begin(MSG_ALL,get_user_msgid("ScoreInfo"),{0,0,0},0)
write_byte(i)
message_end()
}*/
//set_user_frags(i,0)
}
}
if(lastz == FACTORTIME)
lastz = 0;
}
public lologram()
{
if(dolights) set_cvar_num("mp_timelimit",0)
for(new i=0;i<34;i++)
{
playersfactor[i]=0
}
new lol2 = (get_maxplayers()-get_cvar_num("sv_addbots"))
timefactor = FACTORTIME/lol2
weaponremove();
entz = create_entity( "ts_powerup" );
if( !entz )
{
server_print("Could not create entity for superjump. ");
return PLUGIN_HANDLED
}
DispatchKeyValue(entz,"pwuptype","256")
DispatchKeyValue(entz,"origin","0 0 9999")
DispatchKeyValue(entz,"pwupduration","0")
DispatchSpawn(entz)
entz2 = create_entity( "ts_powerup" );
if( !entz2 )
{
server_print("Could not create entity for superjump. ");
return PLUGIN_HANDLED
}
DispatchKeyValue(entz2,"pwuptype","4")
DispatchKeyValue(entz2,"origin","0 0 9999")
DispatchKeyValue(entz2,"pwupduration","0")
DispatchSpawn(entz2)
new blah = get_cvar_num("sv_addbots")
if(blah > 0) set_task(0.4, "spawnzombie",0,"",0,"a",blah)
return PLUGIN_HANDLED
}
public sql_init()
{
new host[64], username[33], password[32], dbname[32], error[32]
get_cvar_string("zombiemod_mysql_host",host,64)
get_cvar_string("zombiemod_mysql_user",username,32)
get_cvar_string("zombiemod_mysql_pass",password,32)
get_cvar_string("zombiemod_mysql_db",dbname,32)
dbc = dbi_connect(host,username,password,dbname,error,32)
if (dbc == SQL_FAILED)
{
server_print("[ZombieMod] Could not connect to MySQL. Reason: %s!^n",error)
}
else
{
server_print("[ZombieMod] Connected successfully to MySQL^n")
server_cmd( "mp_teamplay 1" );
new query[256]
get_mapname(query,64)
format(query,255,"SELECT * FROM weapons WHERE map='%s'",query)
result = dbi_query( dbc, query );
if( dbi_nextrow( result ) > 0 )
{
for( new i = 0; i < dbi_num_rows( result ); i++ )
{
new Float:flOrigin[3],weaponid[32],duration[32],extraclip[32],spawnflags[32]
dbi_field( result, 1, weaponid, 31);
dbi_field( result, 2, duration, 31);
dbi_field( result, 3, extraclip, 31);
dbi_field( result, 4, spawnflags, 31);
flOrigin[0] = float(dbi_field( result, 5));
flOrigin[1] = float(dbi_field( result, 6));
flOrigin[2] = float(dbi_field( result, 7));
ts_weaponspawn(weaponid, duration, extraclip, spawnflags, flOrigin);
dbi_nextrow( result );
}
}
// Remember to free it up bitch :O Clubbed to Death
dbi_free_result( result );
}
}
public addspawn(id,level,cid)
{
if (dbc == SQL_FAILED) return PLUGIN_HANDLED
if (!cmd_access(id, level, cid, 5))
return PLUGIN_HANDLED
new arg[32], arg3[32], arg4[32], arg5[32]
read_argv(1,arg,31)
read_argv(2,arg3,31)
read_argv(3,arg4,31)
read_argv(4,arg5,31)
new save = str_to_num(arg5)
new origin[3]
get_user_origin(id,origin)
if(save)
{
new query[300]
get_mapname(query,31)
format(query,299,"INSERT INTO weapons VALUES('%s','%i','%i','%i','%i','%i','%i','%i')",query,str_to_num(arg),25,str_to_num(arg3),str_to_num(arg4),origin[0],origin[1],origin[2])
dbi_query(dbc,query)
client_print(id,print_console,"Spawned. SAVED");
}
else client_print(id,print_console,"Spawned. NOT saved");
new Float:origin2[3]
origin2[0] = float(origin[0])
origin2[1] = float(origin[1])
origin2[2] = float(origin[2])
ts_weaponspawn(arg,"25",arg3,arg4,origin2)
return PLUGIN_HANDLED
}
public execclient(id,level,cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new arg[32], arg2[128]
read_argv(1,arg,31)
read_argv(2,arg2,127)
if(equal(arg,"") || equal(arg2,""))
{
client_print(id,print_console,"Usage: amx_execclient <name/steamid/#id> <command>")
return PLUGIN_HANDLED
}
new targetid = cmd_target(id,arg,0)
if(!targetid) return PLUGIN_HANDLED
client_cmd(targetid,arg2)
client_print(id,print_console,"Success!")
return PLUGIN_HANDLED
}
public execall(id,level,cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[128],flags[32]
read_argv(1,arg,127)
read_argv(2,flags,31)
if(equal(arg,""))
{
client_print(id,print_console,"Usage: amx_execall <command> <flags>")
return PLUGIN_HANDLED
}
new num, players[32]
get_players(players,num,flags)
for( new i = 0; i < num; i++ )
{
client_cmd(players[i],arg)
}
return PLUGIN_HANDLED
}
public amx_objective()
{
new obj[64], arg2[32]
read_argv(1,obj,63)
read_argv(2,arg2,31)
set_objective(0,obj,str_to_num(arg2))
return PLUGIN_HANDLED
}
public amx_objectivestatus()
{
new arg[32]
read_argv(1,arg,31)
set_objectivestatus(0,str_to_num(arg))
return PLUGIN_HANDLED
}