Jump to content

interiors resource problem


Ryder!

Recommended Posts

function resourceStart()
addEventHandler( "onPlayerInteriorWarped", getRootElement(), onInteriorEnter )
end
 
addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), resourceStart  )
 
function onInteriorEnter( interior )
outputChatBox( tostring(getElementInterior( source ) ) ) --it output always 0
outputChatBox( getElementType ( interior ) )
--outputChatBox( tostring(getPlayerName( source ) ), source )
end

the problem is that getElementInterior output always 0 when entering any interior =S

I have only this script running and interiors.

http://mta.pastebay.com/51409

Link to comment

We cannot see how you are triggering "onPlayerInteriorWarped", which is important seeing as it is a custom event.

However, if getElementInterior(source) is returning 0, there are only 2 reasons I can think of for that:

1. You are specifying the source as the Root Element in your triggerEvent line, not the player.

bool triggerEvent ( string eventName, element baseElement, [ var argument1, ... ] )  --baseElement should be your player in this case

2. You are triggering this event before you warp them into the interior.

(Even if it's only 1 line above the setElementInterior line, it'll return 0, not the interior id.)

Link to comment

Ah, my mistake.

In that case, why are you attempting to get the player element's interior while they're warping in (e.g. before it is finished warping them, so they haven't switched interior yet) when the event already provides both the player that is warping (source) and the interior he is entering (interior)?

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