Hello MTA SA community i'm trying to make a anti shortcut script for a map. In this script the player is suppose to drive through all 3 CORONAS, at the very end the 4th corona will check that the player hit all 3 previous coronas. If the player some how misses on he will be denied at the end. (I'm still new to the scripting community. I understand the concept but i would l like to know what i'm missing)
-Thanks
local playerHitCorona = {}
local coronaElement = {}
coronaElement[1] = createMarker(3955.6198730469, -1604.9947509766, 56.082000732422, "corona", 15, 0, 0, 255)
coronaElement[2] = createMarker(3222.6970214844, -1473.5163574219, -1.5256999731064, "corona", 40, 0, 0, 255)
coronaElement[3] = createMarker(3465.4184570313, -505.55020141602, 6.6930999755859, "corona", 15, 0, 0, 255)
coronaElement[4] = createMarker(3788.0246582031, -807.74267578125, 110.54779815674, "corona", 10, 0, 0, 255) -- corona before hunter pickup
-- and so on
addEventHandler( "onClientMarkerHit", root, MarkerHit )
function MarketHit (player)
if player == localPlayer then
if source == coronaElement[1] then -- you check that the player hit the first corona
playerHitCorona[1] = true -- set it to true, that means that the player hit the corona
elseif source == coronaElement[2] then -- same as above
playerHitCorona[2] = true
elseif source == coronaElement[3] then -- on this corona, you check that the player hit all previous coronas
playerHitCorona[1] = true playerHitCorona[2] = true
elseif source == coronaElement[4] then
if playerHitCorona[1] and playerHitCorona[2] and playerHitCorona[3] then -- You forgot the IF statements
-- player hit all coronas, do nothing
else
local veh = getPedOccupiedVehicle(localPlayer) -- You also didn't define the veh variable, vehicle wasn't going to blow
outputChatBox("#ADD8E6AW#FFFFFFOL: You're not worthy")
blowVehicle(veh) -- player did not hit all coronas (he made sc) , blow player
end
end
end
end
)