Bilal135 Posted November 7, 2014 Share 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. Link to comment
SkatCh Posted November 7, 2014 Share Posted November 7, 2014 try to use "onMarkerHit". Link to comment
Dealman Posted November 7, 2014 Share Posted November 7, 2014 isElementWithinMarker needs 2 arguments, the element which to look for and the marker. Link to comment
Saml1er Posted November 7, 2014 Share 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. Link to comment
Bilal135 Posted November 7, 2014 Author Share Posted November 7, 2014 Thanks Saml1er. Link to comment
Bilal135 Posted November 7, 2014 Author Share 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? Link to comment
Bilal135 Posted November 7, 2014 Author Share Posted November 7, 2014 Never mind guys, I fixed that by my own. 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