I just started writing scripts, and I really need help. Here is my code:
RegisterCommand('rescar', function(source, args, rawCommand)
if(source > 0) then
local vehId = GetVehiclePedIsIn(source, false)
if vehId ~= 0 then
TriggerClientEvent('chat:addMessage', source, {
color = {220,220,220},
multiline = true,
args = {"[RESCAR]", string.format("Your vehicle: %s", GetEntityModel(source))}
})
end
end
end, false)
For now it should just print the type of car the player is in, but when I run it, I get this error message:
SCRIPT ERROR: @rescar/server.lua:3: attempt to call a nil value (global 'GetVehiclePedIsIn')
Also, here is my fxmanifest.lua:
fx_version 'bodacious'
game 'gta5'
author 'Simi23'
description 'A script which respawns your car with the same handling'
version '1.0.0'
server_script 'server.lua'
What am I doing wrong?