Genius Posted May 11, 2012 Posted May 11, 2012 When i hit firstMarker then secondMarker spawned but when i hit him then i didint get money jobMarker = 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 ) outputChatBox ( "You are now Robber.", hitPlayer ) firstMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) end addEventHandler ( "onMarkerHit", jobMarker, robber ) function onmarker1 ( thePlayer ) destroyElement ( secondMarker ) givePlayerMoney ( thePlayer, 856 ) secondMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190 ) end addEventHandler ( "onMarkerHit", firstMarker, onmarker1 ) function onmarker2 ( hitPlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( hitPlayer, 856 ) end addEventHandler ( "onMarkerHit", secondMarker, onmarker2 ) MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 11, 2012 Posted May 11, 2012 (edited) try this: jobMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) addEventHandler ( "onMarkerHit", jobMarker,function( Player ) setElementModel ( Player, 115 ) setPlayerTeam ( Player, getTeamFromName("Criminal")) outputChatBox ( "You are now Robber.", Player ) firstMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", firstMarker, onmarker1 ) end) function onmarker1 ( thePlayer ) if(isElement(secondMarker))then destroyElement ( secondMarker ) end givePlayerMoney ( thePlayer, 856 ) secondMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", secondMarker, onmarker2 ) end function onmarker2 ( hitPlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( hitPlayer, 856 ) end Edited May 13, 2012 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 11, 2012 Author Posted May 11, 2012 try this:jobMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) teamCriminal = createTeam( "Criminal", 249, 19, 75) addEventHandler ( "onMarkerHit", jobMarker,function( hitPlayer ) setElementModel ( hitPlayer, 115 ) setPlayerTeam ( hitPlayer, setTeamFromName("Criminal")) outputChatBox ( "You are now Robber.", hitPlayer ) firstMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", firstMarker, onmarker1 ) end) function onmarker1 ( thePlayer ) if(iElement(secondMarker))then destroyElement ( secondMarker ) end givePlayerMoney ( thePlayer, 856 ) secondMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", secondMarker, onmarker2 ) end function onmarker2 ( hitPlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( hitPlayer, 856 ) end Doesnt work MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 11, 2012 Posted May 11, 2012 I've edited it, try it again My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted May 11, 2012 Posted May 11, 2012 @Genius: You attached the event handlers to a non-existent element, the marker wasn't created for then. jobMarker = 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 ) outputChatBox ( "You are now Robber.", hitPlayer ) firstMarker = createMarker ( 2144.3, -1663.7, 14.6, "cylinder", 2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", firstMarker, onmarker1 ) -- Here end addEventHandler ( "onMarkerHit", jobMarker, robber ) function onmarker1 ( thePlayer ) destroyElement ( secondMarker ) givePlayerMoney ( thePlayer, 856 ) secondMarker = createMarker ( 2146.3, -1470.4, 25.1, "cylinder", 2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", secondMarker, onmarker2 ) -- And here end function onmarker2 ( hitPlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( hitPlayer, 856 ) end @Jaysd1: There's no such function: setTeamFromName. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Genius Posted May 11, 2012 Author Posted May 11, 2012 I've edited it, try it again Work but when i hit firstMarker then i want hit 2 times firstMarket then he is destroyed,and when i hit secondMarker he didnt destoryed Edit: @Genius: You attached the event handlers to a non-existent element, the marker wasn't created for then. jobMarker = 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 ) outputChatBox ( "You are now Robber.", hitPlayer ) firstMarker = createMarker ( 2144.3, -1663.7, 14.6, "cylinder", 2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", firstMarker, onmarker1 ) -- Here end addEventHandler ( "onMarkerHit", jobMarker, robber ) function onmarker1 ( thePlayer ) destroyElement ( secondMarker ) givePlayerMoney ( thePlayer, 856 ) secondMarker = createMarker ( 2146.3, -1470.4, 25.1, "cylinder", 2, 249, 19, 75, 190 ) addEventHandler ( "onMarkerHit", secondMarker, onmarker2 ) -- And here end function onmarker2 ( hitPlayer ) destroyElement ( thirdMarker ) givePlayerMoney ( hitPlayer, 856 ) end @Jaysd1: There's no such function: setTeamFromName. Its work Solidsnake14 tnx man MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Castillo Posted May 11, 2012 Posted May 11, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted May 17, 2012 Posted May 17, 2012 To create a blip you can either use: createBlipAttachedTo or createBlip. First one is used to attach the blip to another element, second is used to create a blip on the given coordinates. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Genius Posted May 17, 2012 Author Posted May 17, 2012 To create a blip you can either use: createBlipAttachedTo or createBlip.First one is used to attach the blip to another element, second is used to create a blip on the given coordinates. I know MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
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