Atton Posted January 27, 2014 Share Posted January 27, 2014 I was working on a bit of code for a pay and spray there seems to be having some issues. I keep getting bad arguments on these. local vehicle = getPedOccupiedVehicle(thePlayer) local money = getPlayerMoney(thePlayer) --pasMarkersT [Table removed to keep things easy] function Markers () for a,b in pairs(pasMarkersT) do PAS = createMarker(b["x"], b["y"], b["z"]-1,"cylinder",5) createBlip(b["x"], b["y"], b["z"]-1,63) addEventHandler("onMarkerHit",PAS,Logic) end end setTimer(Markers,50,1) price = 100 function Logic (hitElement, matchingDimension,thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) local money = getPlayerMoney(thePlayer) local elementType = getElementType(hitElement) if (elementType == "vehicle") then if (money >= price) then if getElementHealth(vehicle) < 1000 then takePlayerMoney(player, price) fixVehicle(vehicle) outputChatBox("Thank you for using pay and spray have a nice day.",plr,0,255,0) else outputChatBox("Get Lost!",player,255,0,0) end end end end Link to comment
TAPL Posted January 27, 2014 Share Posted January 27, 2014 --pasMarkersT [Table removed to keep things easy] function Markers() for a,b in pairs(pasMarkersT) do PAS = createMarker(b["x"], b["y"], b["z"]-1,"cylinder",5) createBlip(b["x"], b["y"], b["z"]-1,63) addEventHandler("onMarkerHit",PAS,Logic) end end setTimer(Markers,50,1) function Logic(hitElement) if getElementType(hitElement) == "vehicle" then local player = getVehicleController(hitElement) if player and getPlayerMoney(player) >= 100 then if getElementHealth(hitElement) < 1000 then takePlayerMoney(player, 100) fixVehicle(hitElement) outputChatBox("Thank you for using pay and spray have a nice day.", player, 0, 255, 0) else outputChatBox("Get Lost!", player, 255, 0, 0) end end end end Link to comment
Atton Posted January 28, 2014 Author Share Posted January 28, 2014 Had to make some changes but it works thanks. 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