1
+ #include < amxmodx>
2
+ #include < amxmisc>
3
+ #include < engine>
4
+ #include < hamsandwich>
5
+
6
+ #include < zp50_core>
7
+ #include < zp50_items>
8
+ #include < zp50_class_nemesis>
9
+ #include < zp50_class_survivor>
10
+
11
+
12
+ # define PLUGIN " [ZP] Item: Multi-Jump"
13
+ # define VERSION " 1.0"
14
+ # define AUTHOR " Xalus"
15
+
16
+ // Global Variables
17
+ new zpItem
18
+
19
+ new zpMultiJump[33 ]
20
+ new bool: plJump[33 ], plJumps[33 ]
21
+
22
+ public plugin_init () {
23
+ register_plugin (PLUGIN, VERSION, AUTHOR)
24
+
25
+ // Register: Extra item
26
+ zpItem = zp_items_register (" Multi-Jump" , 8 )
27
+
28
+ RegisterHam (Ham_Spawn, " player" , " Ham_PlayerSpawn" , 1 );
29
+ }
30
+
31
+ public zp_fw_items_select_pre (id, itemid) {
32
+ if (itemid == zpItem) {
33
+ if ( zp_class_survivor_get (id) || zp_class_nemesis_get (id))
34
+ return ZP_ITEM_DONT_SHOW
35
+ }
36
+ return ZP_ITEM_AVAILABLE;
37
+ }
38
+
39
+ public zp_fw_core_infect_post (id, attacker)
40
+ zpMultiJump[id] = 0
41
+
42
+ public zp_fw_items_select_post(player, itemid) {
43
+ if (itemid == zpItem) {
44
+ zpMultiJump[player]++
45
+ client_print (player, print_center, " Now you can jump %i time(s) in mid-air." , zpMultiJump[player]);
46
+ }
47
+ }
48
+
49
+ public Ham_PlayerSpawn (id)
50
+ if (is_user_alive (id))
51
+ zpMultiJump[id] = 0
52
+
53
+ public client_PreThink(id) {
54
+ if (! is_user_alive (id) || ! zpMultiJump[id])
55
+ return
56
+
57
+ new plButton[2 ]
58
+ plButton[0 ] = get_user_button (id)
59
+ plButton[1 ] = get_user_oldbutton (id)
60
+
61
+ if ( (plButton[0 ] & IN_JUMP) && ! (get_entity_flags (id) & FL_ONGROUND) && ! (plButton[1 ] & IN_JUMP)) {
62
+ if (plJumps[id] < zpMultiJump[id]) {
63
+ plJump[id] = true
64
+ plJumps[id]++
65
+ }
66
+ }
67
+ else if ((plButton[0 ] & IN_JUMP) && (get_entity_flags (id) & FL_ONGROUND))
68
+ plJumps[id] = 0
69
+ }
70
+
71
+ public client_PostThink (id) {
72
+ if (! is_user_alive (id) || ! plJump[id] || ! zpMultiJump[id])
73
+ return
74
+
75
+ new Float: velocity[3 ]
76
+ entity_get_vector (id,EV_VEC_velocity,velocity)
77
+ velocity[2 ] = random_float (265 .0 ,285 .0 )
78
+ entity_set_vector (id,EV_VEC_velocity,velocity)
79
+ plJump[id] = false
80
+ }
0 commit comments