Skip to content

Commit

Permalink
Add model type validity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kibook committed Feb 14, 2022
1 parent 7658117 commit b3f6075
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ function PlaceEntityOnGroundProperly(entity, p1)
return Citizen.InvokeNative(0x9587913B9E772D29, entity, p1)
end

function IsModelAnObject(model)
return Citizen.InvokeNative(0x274EE1B90CFA669E, model)
end

function EnableSpoonerMode()
local x, y, z = table.unpack(GetGameplayCamCoord())
local pitch, roll, yaw = table.unpack(GetGameplayCamRot(2))
Expand Down Expand Up @@ -624,6 +628,10 @@ function SpawnObject(name, model, x, y, z, pitch, roll, yaw, collisionDisabled,
return nil
end

if not IsModelAnObject(model) then
return nil
end

if not LoadModel(model) then
return nil
end
Expand Down Expand Up @@ -678,6 +686,10 @@ function SpawnVehicle(name, model, x, y, z, pitch, roll, yaw, collisionDisabled,
return nil
end

if not IsModelAVehicle(model) then
return nil
end

if not LoadModel(model) then
return nil
end
Expand Down Expand Up @@ -750,6 +762,10 @@ function SpawnPed(props)
return nil
end

if not IsModelAPed(props.model) then
return nil
end

if not LoadModel(props.model) then
return nil
end
Expand Down

0 comments on commit b3f6075

Please sign in to comment.