Okay, Okay
I think the problem is getMarkerColor, in my view it should be something with checkpoints, I made this part of code with tutorial and it still doen'st works ? what Can I change ? ;)
function checkpoint:getCheckpoint(i)
local realcheckpoint = g_Checkpoints[i]
local checkpoint = {}
for k,v in pairs(realcheckpoint) do
checkpoint[k] = v
end
checkpoint.vehicle = self:getRandomVehicle(checkpoint)
return checkpoint
vehiclesid = {429, 541, 480 , 411 , 565}
function giveRandomCar( hitElement)
local r = getMarkerColor(source)
local x,y,z = getElementPosition(hitElement)
if r == 255 and getElementType(getVehicleController(hitElement)) == "Player" then
local veh = createVehicle(vehiclesid[math.random(1,#vehiclesid)],x,y,z,0,0,getElementRotation(hitElement))
if veh then
warpPedIntoVehicle(getVehicleController(hitElement),veh)
if getElementType(hitElement) == "Vehicle" then
destroyElement (hitElement)
end
end
end
end
addEventHandler( "onMarkerHit", getRootElement() ,giveRandomCar)