spAik Posted September 14, 2013 Share Posted September 14, 2013 Hi, I want a special Marker being created when a map starts. Als people should get money when they jump through it. Whats wrong? addEvent("onRaceStateChanging", true) addEventHandler("onRaceStateChanging", getRootElement(), function(newState, oldState) if(newState == "Running")then myMarker = createMarker ( 156.8359375, 2504.0920410156, 34, "ring", 6.7, 255, 0, 0, 255 ) end end) addEventHandler("onMarkerHit", getRootElement(), function MarkerHit( source, player, matchingDimension ) -- define MarkerHit function for the handler if source == myMarker then setTimer ( function() myMarker = createMarker ( 156.8359375, 2504.0920410156, 34, "ring", 6.7, 255, 0, 0, 255 ) end, 500, 1 ) local account = getPlayerAccount (player) setAccountData(account, "cash", getAccountData(account,"cash") + 100 ) outputChatBox ( "#FFFFFFYou have earned #FF0000$100#FFFFFF for that jump!", player,255,0,0,true) scoreboardRefresh(player) end end) Link to comment
Castillo Posted September 14, 2013 Share Posted September 14, 2013 Main problem was that you were defining the function name, but with the method you were attaching the event handler of "onMarkerHit", it didn't work. addEvent ( "onRaceStateChanging", true ) addEventHandler ( "onRaceStateChanging", getRootElement(), function ( newState, oldState ) if ( newState == "Running" ) then myMarker = createMarker ( 156.8359375, 2504.0920410156, 34, "ring", 6.7, 255, 0, 0, 255 ) end end ) addEventHandler ( "onMarkerHit", getRootElement(), function ( player, matchingDimension ) -- define MarkerHit function for the handler if ( getElementType ( player ) == "player" ) then if ( source == myMarker ) then setTimer ( function ( ) myMarker = createMarker ( 156.8359375, 2504.0920410156, 34, "ring", 6.7, 255, 0, 0, 255 ) end ,500, 1 ) local account = getPlayerAccount ( player ) setAccountData ( account, "cash", getAccountData ( account, "cash" ) + 100 ) outputChatBox ( "#FFFFFFYou have earned #FF0000$100#FFFFFF for that jump!", player, 255, 0, 0, true ) scoreboardRefresh ( player ) end end end ) Link to comment
spAik Posted September 14, 2013 Author Share Posted September 14, 2013 works thanks for pointing out that error. thanks for the great support u have done so far here! You are like the good heart of this forum 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