Price. Posted March 22, 2015 Share Posted March 22, 2015 So I got a problem in this script, I want to make if player is in job "Pilot" and if he enters a shamal the blip appears only to him, I have 3 blips only 1 appears and doesnt get destroyed after player hits the marker also I'm trying to do if Player hits a marker then marker gets destroyed as the blip also, and other blip gets created with marker as I specify the location, now THERE ARE SOME ERRORS, I just want some help to do what I said above. Server Side: pilot = createTeam("Pilot",255,255,0) marker1 = createMarker(1591.93921, 1448.08423, 9.83063,"cylinder",2,0,150,255,255) marker5 = createMarker(-1415.17041 ,-131.17546 ,13.14397,"cylinder",2,0,150,255,255) marker6 = createMarker(2006.68823, -2289.57202 ,12.54688,"cylinder",2,0,150,255,255) blip11 = createBlip(2006.68823, -2289.57202 ,13.54688,41,2) marker2 = createMarker(-1385.98352, -216.73637 ,13.14844,"cylinder",6,255,255,0,255) marker3 = createMarker(1891.00195, -2624.34082 ,13.54688,"cylinder",6,255,255,0,255) marker4 = createMarker(1604.27612 ,1266.63037 ,10.81250,"cylinder",6,255,255,0,255) setElementAlpha(marker2,0) setElementAlpha(marker3,0) setElementAlpha(marker4,0) ------------ function getJob(thePlayer) setElementAlpha(marker2,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker1,getJob) ---------------- function getJob2(thePlayer) marker3 = createMarker(1891.00195, -2624.34082 ,13.54688,"cylinder",6,255,255,0,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker5,getJob2) --------------- function getJob3(thePlayer) marker2 = createMarker(-1385.98352, -216.73637 ,13.14844,"cylinder",6,255,255,0,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker6,getJob3) -------- function giveCash( thePlayer ) theVehicle = getPedOccupiedVehicle( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,800) exports["TopBarChat"]:sendClientMessage("You have earned $800",thePlayer, 0, 90, 90, true, -- s8) --> setElementAlpha(marker3,255) blip3 = createBlip(1891.00195, -2624.34082 ,13.54688,51,2) exports["TopBarChat"]:sendClientMessage ("Go to Los Santos International Airport",thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker2) destroyElement(blip2) end end addEventHandler("onMarkerHit",marker2,giveCash) ------------ function secondMarker(thePlayer) theVehicle = getPedOccupiedVehicle( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,1000) exports["TopBarChat"]:sendClientMessage("You have earned $1000", thePlayer, 0, 90, 90, true, -- s8) --> setElementAlpha(marker4,255) blip4 = createBlip(1604.27612 ,1266.63037 ,10.81250,51,2) exports["TopBarChat"]:sendClientMessage("Go to Las Venturas Airport for your last trip", thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker3) destroyElement(blip3) end end addEventHandler("onMarkerHit",marker3,secondMarker) --------------- function thirdMarker(thePlayer) theVehicle = getPedOccupiedVehicle( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,1200) exports["TopBarChat"]:sendClientMessage("You have earned $1200", thePlayer, 0, 90, 90, true, -- s8) --> exports["TopBarChat"]:sendClientMessage("You have finished pilot job! Go to the blue blip to get employed again", thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker4) destroyElement(blip4) end end addEventHandler("onMarkerHit",marker4,thirdMarker) ------------- function cancelMission() destroyElement(marker2) destroyElement(marker3) destroyElement(marker4) end addEventHandler("onPlayerWasted", getRootElement(),cancelMission); function loseCash(thePlayer) thePlane = getPedOccupiedVehicle(thePlayer) price = 1001 - getElementHealth(thePlane) takePlayerMoney(thePlayer,price*0.1) exports["TopBarChat"]:sendClientMessage("You lost some load for hitting the jet", thePlayer, 255, 0, 0, true, -- s8) --> end addEventHandler("onVehicleDamage", getRootElement(), loseCash) function cancelMission() destroyElement(marker2) destroyElement(marker3) destroyElement(marker4) end addEventHandler("onPlayerVehicleExit", getRootElement(),cancelMission); client function Blip1 () local theVehicle = getPedOccupiedVehicle(source) if (getVehicleName(theVehicle)) == "Shamal" then if getElementData (localPlayer,"job") == "Pilot" then blip1 = createBlip(-1385.98352, -216.73637 ,13.14844,41,2) end end end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),Blip1) function DestroyBlip1 () if not isPedInVehicle(localPlayer) then destroyElement(blip1) end end addEventHandler("onClientPlayerVehicleExit", getRootElement(), DestroyBlip1 ) function cancelMission() destroyElement(blip1) end addEventHandler("onPlayerWasted", getRootElement(),cancelMission); Link to comment
Addlibs Posted March 22, 2015 Share Posted March 22, 2015 THERE ARE SOME ERRORS More details on these errors should be really useful, you know? Link to comment
Price. Posted March 22, 2015 Author Share Posted March 22, 2015 no errors, read what I said, It only appears me 1 blip and then doesn't get destroyed after I get in marker or the marker gets destroyed too Link to comment
Addlibs Posted March 22, 2015 Share Posted March 22, 2015 The first paragraph does not make any sense to me. Link to comment
Price. Posted March 22, 2015 Author Share Posted March 22, 2015 you should try it then, anyone? Link to comment
Price. Posted March 23, 2015 Author Share Posted March 23, 2015 pilot = createTeam("Pilot",255,255,0) marker1 = createMarker(1591.93921, 1448.08423, 9.83063,"cylinder",2,0,150,255,255) marker5 = createMarker(-1415.17041 ,-131.17546 ,13.14397,"cylinder",2,0,150,255,255) marker6 = createMarker(2006.68823, -2289.57202 ,12.54688,"cylinder",2,0,150,255,255) blip11 = createBlip(2006.68823, -2289.57202 ,13.54688,41,2) marker2 = createMarker(-1385.98352, -216.73637 ,13.14844,"cylinder",6,255,255,0,255) marker3 = createMarker(1891.00195, -2624.34082 ,13.54688,"cylinder",6,255,255,0,255) marker4 = createMarker(1604.27612 ,1266.63037 ,10.81250,"cylinder",6,255,255,0,255) setElementAlpha(marker2,0) setElementAlpha(marker3,0) setElementAlpha(marker4,0) ------------ function getJob(thePlayer) setElementAlpha(marker2,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker1,getJob) ---------------- function getJob2(thePlayer) marker3 = createMarker(1891.00195, -2624.34082 ,13.54688,"cylinder",6,255,255,0,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker5,getJob2) --------------- function getJob3(thePlayer) marker2 = createMarker(-1385.98352, -216.73637 ,13.14844,"cylinder",6,255,255,0,255) setPlayerTeam(thePlayer,pilot) setElementModel(thePlayer,61) setElementData(thePlayer,"job","Pilot") end addEventHandler("onMarkerHit",marker6,getJob3) -------- function Blip1 (thePlayer) local theVehicle = getPedOccupiedVehicle(source) if (getVehicleName(theVehicle)) == "Shamal" then if getElementData (thePlayer,"job") == "Pilot" then blip1 = createBlip(-1385.98352, -216.73637 ,13.14844,41,2) end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), Blip1) function DestroyBlip1 (thePlayer) if not isPedInVehicle(thePlayer) then destroyElement(blip1) end end addEventHandler("onPlayerVehicleExit", getRootElement(), DestroyBlip1 ) ------ function giveCash(thePlayer) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,800) exports["TopBarChat"]:sendClientMessage("You have earned $800",thePlayer, 0, 90, 90, true, -- s8) --> setElementAlpha(marker3,255) blip3 = createBlip(1891.00195, -2624.34082 ,13.54688,41,2) exports["TopBarChat"]:sendClientMessage ("Go to Los Santos International Airport",thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker2) destroyElement(blip1) end end addEventHandler("onMarkerHit",marker2,giveCash) ------------ function secondMarker(thePlayer) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,1000) exports["TopBarChat"]:sendClientMessage("You have earned $1000", thePlayer, 0, 90, 90, true, -- s8) --> setElementAlpha(marker4,255) blip4 = createBlip(1604.27612 ,1266.63037 ,10.81250,41,2) exports["TopBarChat"]:sendClientMessage("Go to Las Venturas Airport for your last trip", thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker3) destroyElement(blip3) end end addEventHandler("onMarkerHit",marker3,secondMarker) --------------- function thirdMarker(thePlayer) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if( theVehicle ) and (getVehicleType(theVehicle)=="Plane") then givePlayerMoney(thePlayer,1200) exports["TopBarChat"]:sendClientMessage("You have earned $1200", thePlayer, 0, 90, 90, true, -- s8) --> exports["TopBarChat"]:sendClientMessage("You have finished pilot job! Go to the blue blip to get employed again", thePlayer, 0, 255, 0, true, -- s8) --> destroyElement(marker4) destroyElement(blip4) end end addEventHandler("onMarkerHit",marker4,thirdMarker) ------------- function cancelMission() destroyElement(marker2) destroyElement(marker3) destroyElement(marker4) end addEventHandler("onPlayerWasted", getRootElement(),cancelMission); function loseCash(thePlayer) thePlane = getPedOccupiedVehicle(thePlayer) price = 1001 - getElementHealth(thePlane) takePlayerMoney(thePlayer,price*0.1) exports["TopBarChat"]:sendClientMessage("You lost some load for hitting the jet", thePlayer, 255, 0, 0, true, -- s8) --> end addEventHandler("onVehicleDamage", getRootElement(), loseCash) function cancelMission() destroyElement(marker2) destroyElement(marker3) destroyElement(marker4) end addEventHandler("onPlayerVehicleExit", getRootElement(),cancelMission); updated it and removed client side, blip1 doesnt get destroyed and those are the following errors line 82: bad argument @ 'destroyElement' [Expected element at argument 1, got nil] line 74: bad argument @ 'getPedOccupiedVehicle' [Expected element at argument 1, got vehicle] getped occupied vehicle in all functions return with error , any help? also blip1 doesnt want to get destroyed? 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