Skip to content

Commit

Permalink
Check for if player is in a vehicle every 500 frames instead of every…
Browse files Browse the repository at this point in the history
… frame also.
  • Loading branch information
lze3 committed Mar 16, 2019
1 parent 21020cb commit 4a4722d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions no-god-mode/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local isInvincible = false
Citizen.CreateThread(function()
while true do
isInvincible = GetPlayerInvincible(PlayerId())
isInVeh = IsPedInAnyVehicle(PlayerPedId(), false)
Citizen.Wait(500)
end
end)
Expand All @@ -15,13 +16,13 @@ Citizen.CreateThread(function()
if isInvincible then
DrawLabel("~r~You are currently in godmode which is ~h~prohibited~h~ on this server, disable it now.")
FreezeEntityPosition(ped, true)
DisablePlayerFiring(player, true)
if IsPedInAnyVehicle(ped, false) then
DisablePlayerFiring(player, true) -- true/false - doesn't seem to do anything different, still disables every frame
if isInVeh then
FreezeEntityPosition(GetVehiclePedIsIn(ped, false), true)
end
else
FreezeEntityPosition(ped, false)
if IsPedInAnyVehicle(ped, false) then
if isInVeh then
FreezeEntityPosition(GetVehiclePedIsIn(ped, false), false)
end
end
Expand Down

0 comments on commit 4a4722d

Please sign in to comment.