DrPhoX Posted February 5, 2012 Share Posted February 5, 2012 Hey.. i can fix this script please... local ROOT = getRootElement() local ME = getLocalPlayer() local Timer = nil addEvent("ghost_off", true) addEventHandler("ghost_off", ROOT, function() exports.race:nametaglock(false) Timer = setTimer(turn_off, 200, 0) end) function turn_off() local myvehicle = getPedOccupiedVehicle(ME) local x, y, z = getElementPosition(ME) for _, vehicle in ipairs(getElementsByType("vehicle")) do local c = isElementCollidableWith(myvehicle, vehicle) local cp = getElementData(getVehicleController(vehicle), "race.checkpoint") if vehicle ~= myvehicle and c == false and cp >= 6 then local vx, vy, vz = getElementPosition(vehicle) local distance = getDistanceBetweenPoints3D(vx, vy, vz, x, y, z) - getElementRadius(vehicle) - getElementRadius(myvehicle) if (distance > 5) then setElementCollidableWith ( myvehicle, vehicle, true ) setElementAlpha ( vehicle, 255 ) setElementAlpha ( getVehicleController( vehicle ), 255 ) else setElementCollidableWith ( myvehicle, vehicle, false ) setElementAlpha ( vehicle, 160) setElementAlpha ( getVehicleController( vehicle ), 160 ) end end end end addEventHandler("onClientMapStopping", ROOT, function() killTimer(Timer) end) addEventHandler("onClientMapStarting", ROOT, function() exports.race:nametaglock(true) end) When a player passes checkpoint (cca 6 cp) so ghostmode will automatically off... but idk where is problem. please help PS: Its only for race mod. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now