Jump to content

Whats wrong with this code?


Hamilton

Recommended Posts

It wont show anything. I do not get any debug errors either.

function showTextDisplay ( player ) 
   local serverDisplay = textCreateDisplay()                             -- create a text display 
   textDisplayAddObserver ( serverDisplay, player )                      -- make it visible to a player 
   local serverText = textCreateTextItem ( "Hello world!", 0.01, 0.3 )    -- create a text item for the display 
   textDisplayAddText ( serverDisplay, serverText )                      -- add it to the display so it is displayed 
end 
addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), showTextDisplay ) 

Link to comment

Hey,

The problem is that onResourceStart does not actually have a player-parameter. It has a source parameter which however in your case would be:

  
function showTextDisplay ( player ) 
-- player == getResourceRootElement(getThisResource()) 
  

Which for obvious reasons is not the player. You can figure the rest from there I am sure.

Regards.

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