Jump to content

textDisplayAddObserver error


Blueman

Recommended Posts

Posted

I'm not sure what this is about but I get a bad argument error when using the following.

  
textDisplayAddObserver ( score, source ) 
  

The text display score is added perfectly but showing it fails.

It's amazing what people will sell nowadays $500 for an animated gif :|

1333328066.png

Posted

Well, we can't really help you if you don't post your full script, with just one line we can't know what you did wrong.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Ok my code is:

  
function score () 
score2 = 0 
score1 = 0 
   local score = textCreateDisplay()                              
   local csscore1 = textCreateTextItem ( "Terrorist: " .. score1 .. " |" , 0.5, 0.5 ) 
   local csscore2 = textCreateTextItem ( "Resistance: " .. score2 .. " |" , 0.5, 0.5 )     
   textDisplayAddText ( score, csscore1 ) 
end                       
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), score ) 
function showscore() 
textDisplayAddObserver ( score, source ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), showscore ) 
  

It's not finished and I am aware that csscore 1 and 2 are overlapping. :|

Images:

23.bmp

It's amazing what people will sell nowadays $500 for an animated gif :|

1333328066.png

Posted

Try this:

function score () 
score2 = 0 
score1 = 0 
   scoreDisplay = textCreateDisplay()                             
   local csscore1 = textCreateTextItem ( "Terrorist: " .. score1 .. " |" , 0.5, 0.5 ) 
   local csscore2 = textCreateTextItem ( "Resistance: " .. score2 .. " |" , 0.5, 0.5 )     
   textDisplayAddText ( scoreDisplay, csscore1 ) 
   textDisplayAddText ( scoreDisplay, csscore2 ) 
end                       
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), score ) 
function showscore() 
textDisplayAddObserver ( scoreDisplay, source ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Try this:
  
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 

Ok and I made some last minute changes that you didn't catch.

Works perfectly :)

It's amazing what people will sell nowadays $500 for an animated gif :|

1333328066.png

Posted

Well... just make these changes to the new code I gave you.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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