Skip to content

Commit 9c29d20

Browse files
committed
Implement ManualVehicleEngineAndLights
1 parent 92e0f69 commit 9c29d20

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

amx/server/defines.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,5 @@ PLAYER_VARTYPE_STRING = 2
172172
PLAYER_VARTYPE_FLOAT = 3
173173

174174
INVALID_ACTOR_ID = 0xFFFF
175+
176+
ManualVehEngineAndLights = false

amx/server/events.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,14 @@ addEventHandler('onVehicleEnter', root,
418418
killTimer(amx.vehicles[vehID].respawntimer)
419419
amx.vehicles[vehID].respawntimer = nil
420420
end
421+
422+
if ManualVehEngineAndLights then
423+
if amx.vehicles[vehID].neverEntered ~= nil then
424+
if (getVehicleType(source) ~= "Plane" and getVehicleType(source) ~= "Helicopter") then
425+
setVehicleEngineState(source, false)
426+
end
427+
end
428+
end
421429
end
422430
)
423431

amx/server/syscalls.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function AddStaticVehicleEx(amx, model, x, y, z, angle, color1, color2, respawnD
246246
if(vehicle == false) then
247247
return false
248248
end
249-
249+
250250
if not g_PoliceVehicles[model] then
251251
if(color1 <= 0 and color1 >= 126) then color1 = math.random(1, 126) end
252252
if(color2 <= 0 and color2 >= 126) then color2 = math.random(1, 126) end
@@ -259,6 +259,15 @@ function AddStaticVehicleEx(amx, model, x, y, z, angle, color1, color2, respawnD
259259
end
260260
amx.vehicles[vehID].respawndelay = respawnDelay*1000
261261
amx.vehicles[vehID].spawninfo = { x = x, y = y, z = z, angle = angle }
262+
if ManualVehEngineAndLights then
263+
if (getVehicleType(vehicle) ~= "Plane" and getVehicleType(vehicle) ~= "Helicopter") then
264+
setVehicleEngineState(vehicle, false)
265+
for i=0, 4 do
266+
setVehicleLightState(vehicle, i, 0)
267+
end
268+
amx.vehicles[vehID].neverEntered = true
269+
end
270+
end
262271
return vehID
263272
end
264273

@@ -295,6 +304,10 @@ function AttachTrailerToVehicle(amx, trailer, vehicle)
295304
attachTrailerToVehicle(vehicle, trailer)
296305
end
297306

307+
function ManualVehicleEngineAndLights()
308+
ManualVehEngineAndLights = true
309+
end
310+
298311
function Ban(amx, player)
299312
banPlayer(player)
300313
end

0 commit comments

Comments
 (0)