Jump to content

How can I register 2 functions?


proracer

Recommended Posts

Ok so here is my code.

local myMarker = createMarker ( -720,965,11.78,corona,3,255,0,0,255 ) 
  
function MarketHit ( hitElement, mathingDimension ) 
function removePedsHead(thePlayer) 
if getElementType (hitElement) == "player" then 
setPedHeadless(thePlayer, true) 
outputChatBox ("You lost your head.", thePlayer, 255, 140, 0) 
end 
end 
end 
  
addEventHandler ("onMarkerHit", myMarker, MarkerHit) 

I know this is wrong code as Im missing event for function:" removePedsHead".And I don't know where to put it.

I want to know how can I register function:"removePedsHead".Because I saw on Wiki that there is only addComandHandler.So how can I register it for Event?

I want that when some player enters the corona he becomes headless.

Link to comment

you are already doing it with setPedHeadless (though the ped element is wrong)

local myMarker = createMarker ( -720,965,11.78, "corona",3,255,0,0,255 ) 
  
function MarketHit ( hitElement, mathingDimension ) 
  if getElementType (hitElement) == "player" then 
    setPedHeadless(hitElement, true) 
    outputChatBox ("You lost your head.", hitElement, 255, 140, 0) 
  end 
end 
addEventHandler ("onMarkerHit", myMarker, MarkerHit) 

PS: corona should be quoted, cause it's a string argument. well unless corona is a variable.

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...