-stolka- Posted November 9, 2013 Share Posted November 9, 2013 why does the debug reports bad argument for "onMarkerHit" event? function dealDrug ( playerSource ) if ( playerSource ) then myTeam = getPlayerTeam(playerSource) if myTeam then myTeamName = getTeamName(myTeam) if ( myTeamName == "Criminal" ) then setElementFrozen(playerSource, true) setPedAnimation( playerSource, "DEALER", "DEALER_IDLE") x,y,z = getElementPosition(playerSource) markerDeal[playerSource] = createMarker(x,y,z-1, "cylinder", 1.5, 204,0,204) dealerName = getPlayerName( playerSource ) setElementData( markerDeal[playerSource], "dealer", dealerName) bindKey ( playerSource, "w", "down", stopDeal ) bindKey ( playerSource, "a", "down", stopDeal ) bindKey ( playerSource, "s", "down", stopDeal ) bindKey ( playerSource, "d", "down", stopDeal ) setElementData(playerSource, "dStatus", "dealing") else outputChatBox("you are not a Criminal!", playerSource, 255,0,0) end end end end addCommandHandler ( "deal", dealDrug ) function startDealing( hitElement ) outputChatBox("start deal") end addEventHandler( "onMarkerHit", markerDeal[playerSource], startDealing ) Link to comment
Renkon Posted November 9, 2013 Share Posted November 9, 2013 addEventHandler( "onMarkerHit", markerDeal[playerSource], startDealing ) 2nd argument shoul be root Link to comment
Sasu Posted November 9, 2013 Share Posted November 9, 2013 Should be: function dealDrug ( playerSource ) if ( playerSource ) then myTeam = getPlayerTeam(playerSource) if myTeam then myTeamName = getTeamName(myTeam) if ( myTeamName == "Criminal" ) then setElementFrozen(playerSource, true) setPedAnimation( playerSource, "DEALER", "DEALER_IDLE") x,y,z = getElementPosition(playerSource) markerDeal[playerSource] = createMarker(x,y,z-1, "cylinder", 1.5, 204,0,204) dealerName = getPlayerName( playerSource ) setElementData( markerDeal[playerSource], "dealer", dealerName) bindKey ( playerSource, "w", "down", stopDeal ) bindKey ( playerSource, "a", "down", stopDeal ) bindKey ( playerSource, "s", "down", stopDeal ) bindKey ( playerSource, "d", "down", stopDeal ) setElementData(playerSource, "dStatus", "dealing") else outputChatBox("you are not a Criminal!", playerSource, 255,0,0) end end end end addCommandHandler ( "deal", dealDrug ) function startDealing( hitElement ) if hitElement and source == markerDeal[hitElement] and getElementType(hitElement) == "player" then outputChatBox("start deal", hitElement) end end addEventHandler( "onMarkerHit", root, startDealing ) 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