Genius Posted May 10, 2012 Share Posted May 10, 2012 When i take job then when i hit marker1 then i didnt get money and marker didnt destroyed and when i try /debugscript 3 no errors marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) function robber( hitPlayer, dimension ) setElementModel( hitPlayer,115) setPlayerTeam(hitPlayer,teamCriminal) setPlayerNametagColor(hitPlayer,249,19,75) end addEventHandler( "onMarkerHit",marker,robber ) function start( hitPlayer, dimension ) marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190, getRootElement()) end addEventHandler( "onMarkerHit",marker,start ) function hitstart( hitPlayer, dimension ) givePlayerMoney (hitPlayer, 200) destroyElement( marker1 ) end addEventHandler( "onMarkerHit",marker1,hitstart ) Link to comment
TAPL Posted May 10, 2012 Share Posted May 10, 2012 nothing in debugscript 3? realy? marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) function robber(hitPlayer) setElementModel(hitPlayer,115) setPlayerTeam(hitPlayer,teamCriminal) setPlayerNametagColor(hitPlayer,249,19,75) if marker1 then removeEventHandler("onMarkerHit",marker1,hitstart) destroyElement(marker1) end marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) addEventHandler("onMarkerHit",marker1,hitstart) end addEventHandler("onMarkerHit",marker,robber) function hitstart(hitPlayer) givePlayerMoney(hitPlayer, 200) destroyElement(marker1) end Link to comment
Genius Posted May 10, 2012 Author Share Posted May 10, 2012 When i hit marker1 then marker2 didnt spawned in debugscript3 said"Bad argument "addEventHandler"[Expected element at argument 2, got nil] marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) function robber(hitPlayer) setElementModel(hitPlayer,115) setPlayerTeam(hitPlayer,teamCriminal) setPlayerNametagColor(hitPlayer,249,19,75) if marker1 then removeEventHandler("onMarkerHit",marker1,hitstart) destroyElement(marker1) end marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) addEventHandler("onMarkerHit",marker1,hitstart) end addEventHandler("onMarkerHit",marker,robber) function hitstart(hitPlayer) givePlayerMoney(hitPlayer, 886) destroyElement(marker1) end function start12(hitPlayer) marker2 = createMarker(2146.3,-1470.4,25.5,"cylinder",2, 249, 19, 75, 190) end addEventHandler("onMarkerHit",marker1,start12) function hitstart1(hitPlayer) givePlayerMoney(hitPlayer, 856) destroyElement(marker2) end addEventHandler("onMarkerHit",marker2,hitstart1) Link to comment
TAPL Posted May 10, 2012 Share Posted May 10, 2012 you have to do the same as i did add the event when you create the marker. Link to comment
Genius Posted May 10, 2012 Author Share Posted May 10, 2012 Marker2 spawnde but when i hit marker2 then i didnt get money /debugscript 3 "Bad argument"addEventHandler"[Expected element at argument 2, got nil] marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) function robber(hitPlayer) setElementModel(hitPlayer,115) setPlayerTeam(hitPlayer,teamCriminal) setPlayerNametagColor(hitPlayer,249,19,75) outputChatBox ( "You are now Robber.", hitPlayer ) if marker1 then removeEventHandler("onMarkerHit",marker1,hitstart) destroyElement(marker1) end marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) addEventHandler("onMarkerHit",marker1,hitstart) end addEventHandler("onMarkerHit",marker,robber) function hitstart(hitPlayer) givePlayerMoney(hitPlayer, 886) destroyElement(marker1) outputChatBox ( "You have robbed the house and get $886.", hitPlayer ) marker2 = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) end addEventHandler("onMarkerHit",marker1,hitstart) function hitstart1(hitPlayer) givePlayerMoney(hitPlayer, 857) destroyElement(marker2) outputChatBox ( "You have robbed the house and get $857.", hitPlayer ) end addEventHandler("onMarkerHit",marker2,hitstart1) Link to comment
Smart. Posted May 10, 2012 Share Posted May 10, 2012 What like are you talking about? Link to comment
Genius Posted May 10, 2012 Author Share Posted May 10, 2012 What like are you talking about? Robber job! -.- Link to comment
Smart. Posted May 10, 2012 Share Posted May 10, 2012 So, there is a line called robber job? Cool. Link to comment
Genius Posted May 10, 2012 Author Share Posted May 10, 2012 Yes and i need to fix it but idk how Link to comment
Smart. Posted May 10, 2012 Share Posted May 10, 2012 Wrote it in a hurry, anyhow try: firstMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) secondMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) thirdMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) teamCriminal = createTeam( "Criminal", 249, 19, 75) local message = "You have robbed the house and got $857" function robber ( hitPlayer ) setElementModel ( hitPlayer, 115 ) setPlayerTeam ( hitPlayer, teamCriminal ) setPlayerNametagColor ( hitPlayer, teamCriminal ) outputChatBox ( "You are now Robber.", hitPlayer ) end addEventHandler ( "onMarkerHit", firstMarker, robber ) function onMarker1 ( thePlayer ) destroyElement ( secondMarker ) givePlayerMoney ( thePlayer, 856 ) outputChatBox ( message, hitPlayer ) end addEventHandler ( "onMarkerHit", secondMarker, onMarker1 ) function onMarker2 ( thePlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( thePlayer, 856 ) outputChatBox ( message, hitPlayer ) end addEventHandler ( "onMarkerHit", thirdMarker, onMarker2 ) Link to comment
Axel Posted May 10, 2012 Share Posted May 10, 2012 I sugest using onMarkerHit on root then if the source == yourmarkername then continue it.., usualy when u got alot of similar elements that's easier (atleast for me..) Link to comment
Jaysds1 Posted May 11, 2012 Share Posted May 11, 2012 Lol, isn't there another topic about this: viewtopic.php?f=91&t=43231 Link to comment
Jokeℝ1472771893 Posted May 13, 2012 Share Posted May 13, 2012 Lol, isn't there another topic about this: viewtopic.php?f=91&t=43231 its still dont work I Think Link to comment
Axel Posted May 18, 2012 Share Posted May 18, 2012 firstMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) local random = math.random(600,1000) local message = "You have robbed the house and got "..random.."$" function onMarkersHit ( thePlayer ) if source == firstMarker then setElementModel ( thePlayer, 115 ) setPlayerTeam ( thePlayer, teamCriminal ) setPlayerNametagColor ( thePlayer, teamCriminal ) outputChatBox ( "You are now Robber.", thePlayer ) secondMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) blip1 = createBlipAttachedTo(secondMarker,32) end if source == secondMarker then destroyElement ( secondMarker ) destroyElement ( blip1 ) givePlayerMoney ( thePlayer, random ) outputChatBox ( message, thePlayer ) thirdMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) blip2 = createBlipAttachedTo(thirdMarker,32) end if source == thirdMarker then destroyElement ( thirdMarker ) destroyElement ( blip2 ) givePlayerMoney ( thePlayer, random ) outputChatBox ( message, thePlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), onMarkersHit ) 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