FORDIR_Max Posted April 10, 2022 Share Posted April 10, 2022 Hello! Help me please. I can not clear the error. function startJob(thePlayer, key, keyState) local x, y, z = getElementPosition(thePlayer) local mx, my, mz = getElementPosition(marker) if getDistanceBetweenPoints3D(x,y,z,mx,my,mz) <= 2 then setPedArmor(thePlayer, 100) setElementModel(thePlayer,312) setElementModel(theVehicle,428) markerN = createMarker(1551, -1387,14,"checkpoint",1,255,10,10,200,thePlayer) blipOne = createBlipAttachedTo(markerN,0,2,255,0,0,255,14,2,thePlayer) outputChatBox("Go to bank LS",thePlayer,0,200,190,false) end end bindKey(thePlayer,"2","both",startJob) markesR = { [1] = {-519.86, -544.4, 25}, [2] = {2771,-1841,10}, } function jobCreate(hitElement) destroyElement(markerN) destroyElement(blipOne) local WorkMarker = createMarker(markersR,"checkpoint",1,255,0,0,200,hitElement) local blipWork = createBlipAttachedTo(WorkMarker,0,2,255,0,0,255,14,2,hitElement) end addEventHandler("onMarkerHit",markerN,jobCreate) Error:server.lua:26: Bad argument @ 'bindKey' [Expected player at argument 1, got nil] \server.lua:43: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] Thank you! Link to comment
mafioz Posted April 11, 2022 Share Posted April 11, 2022 Sorry for the english. The bindKey specifies a player that is in the function itself, so the script does not see this value * You need to specify an actual player for the key binding instead of thePlayer. ------------- * In addEventHandler instead of markerN write WorkMarker 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