Jump to content

marker hit bad ergument


-stolka-

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...