Jump to content

problem with isElementAttached


Recommended Posts

expedicion1 = createPickup(2273.3220214844, 2443.6247558594, 10.690312385559,3,1273) 
  
function expedicion(thePlayer) 
    outputChatBox ( getPlayerName ( thePlayer ) .. " se ha robado el pene!!", getRootElement(), 255, 0, 0 ) 
    local arrowMarker = createMarker ( 0, 0, 0, "arrow", .75, 255, 0, 0, 170 ) 
    attachElements ( arrowMarker, thePlayer, 0, 0, 2 ) 
    setPedArmor ( thePlayer, 100 )    
end 
addEventHandler("onPickupHit", expedicion1, expedicion) 
  
  
function request_mision(hitPlayer) 
    outputChatBox ("Al parecer estas interesado en el trabajo") 
    outputChatBox ("Anda a buscar el cargamento y llebalo al marker, ahi reciviras tu paga.") 
end 
  
function paga_mision(thePlayer) 
    if ( thePlayer ) then -- if a player triggered this command 
      local status = isElementAttached ( thePlayer ) -- call the function and store it's result in the 'status' variable 
      if ( status ) then -- if the function returned true, tell the player he is attached to something 
         outputChatBox ( "Mr Garrison: Gracias por traer mi pene", thePlayer ) 
         givePlayerMoney ( thePlayer, 1250 ) 
      else -- if the function returned false, tell the player he is not attached to anything 
         outputChatBox ( "Mr Garrison: no tienes mi pene? entoces largate!", thePlayer ) 
      end 
   end 
end 
  
addEventHandler("onMarkerHit", mision1_marker, request_mision) 
addEventHandler("onMarkerHit", mision1_final, paga_mision) 
  

when i hit the pickup (expedicion1) attach the marker to me, but when going to the mision1_final marker say i not attached to any element :S

plz help

bye n sorry for my english

Link to comment
when i hit the pickup (expedicion1) attach the marker to me, but when going to the mision1_final marker say i not attached to any element :S

And this is working as it should be.

This functions checks whether or not an element is attached to another element.

...

Returns true if the specified element is attached to another element, false if it is not attached or if an improper argument is passed.

Try getAttachedElements. I think it should return an empty table if nothing is attached. Might be an easier way, yet I think this'll do.

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