Bilal135 Posted November 7, 2014 Posted November 7, 2014 Hello, I was trying to make a pay and spray script, but I'm getting one error. function consoleCreateMarker(thePlayer) local theMarker = createMarker(1911.2722167969,-1776.7221679688, 13.3828125,"cylinder",2,0,255,255) if isElementWithinMarker(theMarker) then local playerVehicle = getPedOccupiedVehicle(thePlayer) if (playerVehicle) then fixVehicle(playerVehicle) else return false end end end setTimer(consoleCreateMarker, 1000, 1) Error: payandspray\paynspray.lua:3: Bad argument @ 'isElementWithinMarker' [Expected marker at argument 2 got none] Thanks in advance. "Get busy living or get busy dying"
SkatCh Posted November 7, 2014 Posted November 7, 2014 try to use "onMarkerHit". Failure is simply an opportunity to begin again more intelligently - Henry Ford
Dealman Posted November 7, 2014 Posted November 7, 2014 isElementWithinMarker needs 2 arguments, the element which to look for and the marker. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Saml1er Posted November 7, 2014 Posted November 7, 2014 local theMarker = createMarker(1911.2722167969,-1776.7221679688, 13.3828125,"cylinder",2,0,255,255) addEventHandler( "onMarkerHit",theMarker, function (hitElement,mD) if getElementType ( hitElement ) == "player" and mD then if not isPedInVehicle (hitElement ) then return end local playerVehicle = getPedOccupiedVehicle(hitElement) fixVehicle(playerVehicle) end end) You're creating a new marker every 1 sec.
Bilal135 Posted November 7, 2014 Author Posted November 7, 2014 Thanks Saml1er. "Get busy living or get busy dying"
Bilal135 Posted November 7, 2014 Author Posted November 7, 2014 Okay, so I got one more problem. local theMarker = createMarker(1911.2722167969,-1776.7221679688, 13.382,"cylinder",2,255,0,0) addEventHandler( "onMarkerHit",theMarker, function (hitElement,mD) if getElementType ( hitElement ) == "player" and mD then if not isPedInVehicle (hitElement ) then return outputChatBox("Please sit in a vehicle!", hitElement, 255, 0, 0) end local playerVehicle = getPedOccupiedVehicle(hitElement) takePlayerMoney(hitElement, 1000) fixVehicle(playerVehicle) outputChatBox("Vehicle Fixed!", hitElement, 0, 255, 0) else outputChatBox("You are too poor!", hitElement, 255, 0, 0) end if getElementHealth(hitElement) == 100 then return outputChatBox("Vehicle's health is already 100", hitElement, 0, 255, 0) end end) When ever i went into the marker, and my vehicle health was 100, it still takes 1000$ money and the money of the player goes to "-1000$". How can I fix this? So if player will have 1000$ or more than 1000$, he will be able to fix his vehicle, if not, he wont be able. Please, tell me whats the problem? "Get busy living or get busy dying"
Bilal135 Posted November 7, 2014 Author Posted November 7, 2014 Never mind guys, I fixed that by my own. "Get busy living or get busy dying"
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