Karuzo Posted January 13, 2014 Share Posted January 13, 2014 Hello everyone, so i've got a problem : function TaksiFunc() local TaksiTeam = createTeam("Taksici", 255, 255, 0 ) setPlayerTeam(source, TaksiTeam) setElementDimension( source, 120) setElementModel(source, 7) taxi = createVehicle(420, 776.20001220703, -1339.5999755859, 13.39999961853 ) warpPedIntoVehicle(source, taxi) marker1 = createMarker(780.79998779297, -1319.5999755859, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) end addEvent("TaksiSkin", true) addEventHandler("TaksiSkin", root, TaksiFunc) function firstmarker() destroyElement(marker1) marker2 = createMarker(835.09997558594, -1322.1999511719, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) end addEventHandler("onMarkerHit", marker1, firstmarker) function secondmarker() destroyElement(marker2) marker3 = createMarker(942.09997558594, -1287.5, 14.5, "checkpoint", 2, 255, 0, 0, 255) end addEventHandler("onMarkerHit", marker2, secondmarker) function thirdmarker() destroyElement(marker3) marker4 = createMarker(830, -1145.5, 23.700000762939, "checkpoint", 2, 255, 0, 0, 255) end addEventHandler("onMarkerHit", marker3, thirdmarker) function fourthmarker() destroyElement(marker4) marker5 = createMarker(692.20001220703, -1223.9000244141, 16.5, "checkpoint", 2, 255, 0, 0, 255) end addEventHandler("onMarkerHit", marker4, fourthmarker) function fifthmarker() destroyElement(marker5) finish = createMarker(665, -1308.4000244141, 13.5, "checkpoint", 15, 0, 255, 5, 255) end addEventHandler("onMarkerHit", marker5, fifthmarker) function finishmarker(thePlayer) destroyElement(finish) setElementDimension(source, 0 ) outputChatBox("Taksi Job'u bitirdin! Magasin : #FFFF00 25000 TL ", thePlayer, 255, 69, 0, true) setElementPosition(thePlayer, 769.40002441406, -1387.6999511719, 13.60000038147) setPlayerTeam(thePlayer, nil) givePlayerMoney(thePlayer, 25000) end addEventHandler("onMarkerHit", finish, finishmarker) I want to create a marker if thePlayer presses a button and set him to the team. ok so ive done that. it worked , but , i want that the player has to drive thru markers, and if they hit one marker the marker should be destroyed and another marker should be spawned.. but won't work Link to comment
Karuzo Posted January 13, 2014 Author Share Posted January 13, 2014 No one got an idea ? //Edit : Found Errors : [2014-01-13 17:36:53] WARNING: Taksi\server.lua:17: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] [2014-01-13 17:36:53] WARNING: Taksi\server.lua:23: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] [2014-01-13 17:36:53] WARNING: Taksi\server.lua:29: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] [2014-01-13 17:36:53] WARNING: Taksi\server.lua:35: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] [2014-01-13 17:36:53] WARNING: Taksi\server.lua:41: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] [2014-01-13 17:36:53] WARNING: Taksi\server.lua:51: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] but how to fix them ? Link to comment
xScatta Posted January 13, 2014 Share Posted January 13, 2014 Just don't use 'root' use then getRootElement() Link to comment
Karuzo Posted January 13, 2014 Author Share Posted January 13, 2014 Nah, got the problem had to set the Dimension of the Markers to the same as the player But another problem : the Markers won't destroy if the player hits them with the taxi ? why ? Link to comment
Plean Posted January 13, 2014 Share Posted January 13, 2014 Why do you destroy the markers? You could use only one marker and if element hits it just set it to another position. Link to comment
Karuzo Posted January 13, 2014 Author Share Posted January 13, 2014 so ive just tried that, but i don't know how to "call" the marker in each function... so that the marker changes his position... could someone explain it to me? Link to comment
DNL291 Posted January 14, 2014 Share Posted January 14, 2014 function TaksiFunc() local TaksiTeam = createTeam("Taksici", 255, 255, 0 ) setPlayerTeam(source, TaksiTeam) setElementDimension( source, 120) setElementModel(source, 7) taxi = createVehicle(420, 776.20001220703, -1339.5999755859, 13.39999961853 ) warpPedIntoVehicle(source, taxi) marker1 = createMarker(780.79998779297, -1319.5999755859, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker1, firstmarker) end addEvent("TaksiSkin", true) addEventHandler("TaksiSkin", root, TaksiFunc) function firstmarker() destroyElement(marker1) marker2 = createMarker(835.09997558594, -1322.1999511719, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker2, secondmarker) end function secondmarker() destroyElement(marker2) marker3 = createMarker(942.09997558594, -1287.5, 14.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker3, thirdmarker) end function thirdmarker() destroyElement(marker3) marker4 = createMarker(830, -1145.5, 23.700000762939, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker4, fourthmarker) end function fourthmarker() destroyElement(marker4) marker5 = createMarker(692.20001220703, -1223.9000244141, 16.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker5, fifthmarker) end function fifthmarker() destroyElement(marker5) finish = createMarker(665, -1308.4000244141, 13.5, "checkpoint", 15, 0, 255, 5, 255) addEventHandler("onMarkerHit", finish, finishmarker) end function finishmarker(thePlayer) destroyElement(finish) setElementDimension(source, 0 ) outputChatBox("Taksi Job'u bitirdin! Magasin : #FFFF00 25000 TL ", thePlayer, 255, 69, 0, true) setElementPosition(thePlayer, 769.40002441406, -1387.6999511719, 13.60000038147) setPlayerTeam(thePlayer, nil) givePlayerMoney(thePlayer, 25000) end Link to comment
Karuzo Posted January 14, 2014 Author Share Posted January 14, 2014 Thank you DNL291 , the firstmarker (marker1 ) is destroyed on the marker hit , but, if i enter the second marker(marker2) it gives me this error and the marker isn't destroyed : code: function TaksiFunc() local TaksiTeam = createTeam("Taksici", 255, 255, 0 ) setPlayerTeam(source, TaksiTeam) setElementDimension( source, 120) setElementModel(source, 7) taxi = createVehicle(420, 776.20001220703, -1339.5999755859, 13.39999961853 ) warpPedIntoVehicle(source, taxi) marker1 = createMarker(780.79998779297, -1319.5999755859, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker1, firstmarker) setElementDimension(marker1, 120) end addEvent("TaksiSkin", true) addEventHandler("TaksiSkin", root, TaksiFunc) function firstmarker() destroyElement(marker1) marker2 = createMarker(835.09997558594, -1322.1999511719, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker2, secondmarker) setElementDimension(marker2, 120) end function secondmarker() destroyElement(marker2) marker3 = createMarker(942.09997558594, -1287.5, 14.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker3, thirdmarker) setElementDimension(marker3, 120) end function thirdmarker() destroyElement(marker3) marker4 = createMarker(830, -1145.5, 23.700000762939, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker4, fourthmarker) setElementDimension(marker4, 120) end function fourthmarker() destroyElement(marker4) marker5 = createMarker(692.20001220703, -1223.9000244141, 16.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker5, fifthmarker) setElementDimension(marker5, 120) end function fifthmarker() destroyElement(marker5) finish = createMarker(665, -1308.4000244141, 13.5, "checkpoint", 15, 0, 255, 5, 255) addEventHandler("onMarkerHit", finish, finishmarker) setElementDimension(finish, 120) end function finishmarker(thePlayer) destroyElement(finish) setElementDimension(source, 0 ) outputChatBox("Taksi Job'u bitirdin! Magasin : #FFFF00 25000 TL ", thePlayer, 255, 69, 0, true) setElementPosition(thePlayer, 769.40002441406, -1387.6999511719, 13.60000038147) setPlayerTeam(thePlayer, nil) givePlayerMoney(thePlayer, 25000) end Link to comment
Karuzo Posted January 14, 2014 Author Share Posted January 14, 2014 No one can help me ? Link to comment
Plean Posted January 14, 2014 Share Posted January 14, 2014 local markerPositions = { {780.79998779297, -1319.5999755859, 13.39999961853}, {835.09997558594, -1322.1999511719, 13.39999961853}, {942.09997558594, -1287.5, 14.5}, {830, -1145.5, 23.700000762939}, {692.20001220703, -1223.9000244141, 16.5}, {665, -1308.4000244141, 13.5}, {769.40002441406, -1387.6999511719, 13.60000038147} } function TaksiFunc() local TaksiTeam = createTeam("Taksici", 255, 255, 0 ) setPlayerTeam(source, TaksiTeam) setElementDimension(source, 120) setElementModel(source, 7) local taxi = createVehicle(420, 776.20001220703, -1339.5999755859, 13.39999961853 ) setElementDimension(taxi, 120) warpPedIntoVehicle(source, taxi) setElementData(source, 'currentMarker', 1) local x, y, z = unpack(markerPositions[1]) local marker = createMarker(x, y, z, "checkpoint", 2, 255, 0, 0, 255) setElementDimension(marker, 120) setElementVisibleTo(marker, root, false) setElementVisibleTo(marker, source, true) addEventHandler("onMarkerHit", marker, taxiMarkerHit) end addEvent("TaksiSkin", true) addEventHandler("TaksiSkin", root, TaksiFunc) function taxiMarkerHit(hitElement, matchingDimension) if matchingDimension then if isElementVisibleTo(source, hitElement) then local currentMarker = getElementData(hitElement, 'currentMarker') + 1 if currentMarker <= #markerPositions then setElementPosition(source, unpack(markerPositions[currentMarker])) setElementData(hitElement, 'currentMarker', currentMarker) else local taxi = getPedOccupiedVehicle(hitElement) removePedFromVehicle(hitElement, taxi) destroyElement(taxi) outputChatBox("Taksi Job'u bitirdin! Magasin : #FFFF00 25000 TL ", hitElement, 255, 69, 0, true) setElementDimension(hitElement, 0) setElementPosition(hitElement, 769.40002441406, -1387.6999511719, 13.60000038147) setPlayerTeam(hitElement, nil) setElementData(hitElement, 'currentMarker', false) givePlayerMoney(hitElement, 25000) removeEventHandler("onMarkerHit", source, taxiMarkerHit) destroyElement(source) end end end end Link to comment
Deepu Posted January 15, 2014 Share Posted January 15, 2014 THIS GUY KRZO IS A FREAKIN HACKER AND A SCAMMER HE SAID "OH! DON I WILL MAKE YOU AN ADMIN IN MY SERVER, PLEASE MAKE ME FREE SCRIPTS" I SAID " OH SURE KRZO ! DON'T BREAK YOUR PROMISE" HE SAID "MAKE ME PILOT JOB DON" I SAID "SURE FRIEND" HE SAID THANK YOU AND BANNED ME IN HIS SERVER AND REMOVED ME IN SKYPE NOW HE EXAMINED MY SCRIPTS AND TRY TO MAKE A JOB But How does he know to make missions? Poor fellow Link to comment
Karuzo Posted January 15, 2014 Author Share Posted January 15, 2014 Oh come on , stop crying. Youre script was full of bugs and wrong syntax' i dont even use it on my server. So just calm down and stol crying. Btw you neede 3 hours for 30 lines ^^ Thank you @Plean: it worked ! 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