Hello all!
I know i already have posted this, but i didn't got a answer
Well, the problem is that i can't spawn a vehicle, line 15 says " attempt to compare nil with number "
Server:
--# Create Vehicle
addEvent("onPlayerRequest:Vehicle",true);
addEventHandler("onPlayerRequest:Vehicle",getRootElement(),
function(carID)
local disallowedVehicles = { {425}, {432} }
local vehicleSpawnCounter = {}
local vehicleSpawnLimit = 2
if getElementType(source) == "player" then
for i,v in ipairs (disallowedVehicles) do
if (v[1] == carID) then
outputChatBox("This is disallowed vehicle!",source,255,0,0)
return false
end
end
if vehicleSpawnCounter[source] < vehicleSpawnLimit then
local playerX,playerY,playerZ = getElementPosition(source)
vehicle = createVehicle(carID,playerX + 2,playerY +2, playerZ)
vehicleSpawnCounter[source] = vehicleSpawnCounter[source] + 1
else
outputChatBox("Vehicle Spawn Limit Reached!", source,255,0,0)
end
end
end)
Thanks !