A fuel-limited jetpack: hold +jetpack to fly along your aim with lift and a thrust light, drain a fuel bar, and refill it on the ground. Access can be flag-restricted.
csb_jetpack.sma v1.0.0
1
/*
2
* CSB Jetpack
3
* Copyright (C) 2026 counter-strike-boost.com
4
*
5
* A fuel-limited jetpack. Bind a key to +jetpack: while held, the player is
6
* pushed along their aim direction with a little lift, a thrust light burns at
7
* their feet and the fuel bar drains. Standing on the ground refills the fuel.
8
* Access can be restricted to a flag so it becomes a VIP perk.
9
*
10
* Inspired by VEN's classic Jetpack plugin for AMX Mod X. This is an
11
* independent GPL re-implementation; no original code is reused.
12
*
13
* This program is free software: you can redistribute it and/or modify it under
14
* the terms of the GNU General Public License as published by the Free Software
15
* Foundation, either version 3 of the License, or (at your option) any later
16
* version. It is distributed in the hope that it will be useful, but WITHOUT
17
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
* FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
19
*/
20
21
#include <amxmodx>
22
#include <amxmisc>
23
#include <fakemeta>
24
#include <fun>
25
26
new const PLUGIN[] = "CSB Jetpack"
27
new const VERSION[] = "1.0.0"
28
new const AUTHOR[] = "counter-strike-boost.com"
29
30
#define SVC_TEMPENTITY 23
31
#define TE_DLIGHT 27
32
#define TASK_THINK 5500
33
34
new g_pEnabled, g_pPower, g_pLift, g_pDrain, g_pRegen, g_pAccess, g_pSound
35
36
new bool:g_bThrust[33]
37
new Float:g_fFuel[33]
38
new g_szSound[64]
39
new g_iSyncHud
40
41
public plugin_precache()
42
{
43
g_pSound = register_cvar("csb_jet_sound", "")
44
get_pcvar_string(g_pSound, g_szSound, charsmax(g_szSound))
45
46
if (g_szSound[0])
47
precache_sound(g_szSound)
48
}
49
50
public plugin_init()
51
{
52
register_plugin(PLUGIN, VERSION, AUTHOR)
53
54
g_pEnabled = register_cvar("csb_jet_enabled", "1")
55
g_pPower = register_cvar("csb_jet_power", "320") // forward speed
56
g_pLift = register_cvar("csb_jet_lift", "170.0") // upward push
57
g_pDrain = register_cvar("csb_jet_drain", "1.5") // fuel per tick
58
g_pRegen = register_cvar("csb_jet_regen", "2.0") // fuel per tick on ground
59
g_pAccess = register_cvar("csb_jet_flag", "") // required admin flag(s), empty = everyone
60
61
register_clcmd("+jetpack", "cmdThrustOn")
62
register_clcmd("-jetpack", "cmdThrustOff")
63
64
g_iSyncHud = CreateHudSyncObj()
65
66
set_task(0.1, "taskThink", TASK_THINK, _, _, "b")
67
}
68
69
public client_putinserver(id)
70
{
71
g_bThrust[id] = false
72
g_fFuel[id] = 100.0
73
}
74
75
public client_disconnected(id)
76
{
77
g_bThrust[id] = false
78
}
79
80
bool:hasAccess(id)
81
{
82
new flags[8]
83
get_pcvar_string(g_pAccess, flags, charsmax(flags))
84
85
if (!flags[0])
86
return true
87
88
return (get_user_flags(id) & read_flags(flags)) ? true : false
89
}
90
91
public cmdThrustOn(id)
92
{
93
if (!get_pcvar_num(g_pEnabled))
94
return PLUGIN_HANDLED
95
96
if (!hasAccess(id))
97
{
98
client_print(id, print_chat, "[CSB] The jetpack is reserved for VIP players.")
99
return PLUGIN_HANDLED
100
}
101
102
g_bThrust[id] = true
103
return PLUGIN_HANDLED
104
}
105
106
public cmdThrustOff(id)
107
{
108
g_bThrust[id] = false
109
return PLUGIN_HANDLED
110
}
111
112
public taskThink()
113
{
114
new Float:power = float(get_pcvar_num(g_pPower))
115
new Float:lift = get_pcvar_float(g_pLift)
116
new Float:drain = get_pcvar_float(g_pDrain)
117
new Float:regen = get_pcvar_float(g_pRegen)
118
119
new players[32], num, pid, origin[3]
120
get_players(players, num, "a")
121
122
for (new i = 0; i < num; i++)
123
{
124
pid = players[i]
125
126
new bool:onGround = (pev(pid, pev_flags) & FL_ONGROUND) ? true : false
127
128
if (g_bThrust[pid] && g_fFuel[pid] > 0.0 && get_pcvar_num(g_pEnabled))
129
{
130
new Float:aim[3]
131
velocity_by_aim(pid, floatround(power), aim)
132
133
new Float:vel[3]
134
pev(pid, pev_velocity, vel)
135
vel[0] = aim[0]
136
vel[1] = aim[1]
137
vel[2] = aim[2] + lift
138
set_pev(pid, pev_velocity, vel)
139
140
g_fFuel[pid] -= drain
141
if (g_fFuel[pid] < 0.0)
142
g_fFuel[pid] = 0.0
143
144
/* thrust light at the feet */
145
get_user_origin(pid, origin)
146
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
147
write_byte(TE_DLIGHT)
148
write_coord(origin[0])
149
write_coord(origin[1])
150
write_coord(origin[2] - 20)
151
write_byte(6)
152
write_byte(255)
153
write_byte(random_num(120, 200))
154
write_byte(0)
155
write_byte(2)
156
write_byte(4)
157
message_end()
158
159
if (g_szSound[0])
160
emit_sound(pid, CHAN_STATIC, g_szSound, 0.4, ATTN_NORM, 0, PITCH_NORM)
161
}
162
else if (onGround && g_fFuel[pid] < 100.0)
163
{
164
g_fFuel[pid] += regen
165
if (g_fFuel[pid] > 100.0)
166
g_fFuel[pid] = 100.0
167
}
168
169
showFuel(pid)
170
}
171
}
172
173
showFuel(id)
174
{
175
/* only bother while flying or when the tank is not full */
176
if (!g_bThrust[id] && g_fFuel[id] >= 100.0)
177
return
178
179
new pct = floatround(g_fFuel[id])
180
new bar[11], filled = pct / 10
181
182
for (new i = 0; i < 10; i++)
183
bar[i] = (i < filled) ? '|' : '.'
184
bar[10] = 0
185
186
set_hudmessage(0, 180, 255, 0.02, 0.85, 0, 0.0, 0.3, 0.0, 0.0, -1)
187
ShowSyncHudMsg(id, g_iSyncHud, "Jetpack [%s] %d%%", bar, pct)
188
}
189









