KITT1995 Posted July 31, 2011 Share Posted July 31, 2011 Hi, I want to make script that show a TextDisplay when a player join (only to the player who join, not all player). I tried with this code but when a player join, the script give this error appear in the server log "WARNING: replace\script2.lua:3: Bad argument @ 'textDisplayAddObserver' This is the code of the script function showTextDisplay ( source, command ) local serverDisplay = textCreateDisplay() textDisplayAddObserver ( serverDisplay, source ) local serverText = textCreateTextItem ( "Downloading new vehicles!", 0.5, 0.0, 2, 0, 255, 255, 255, 5, "center", "top" ) textDisplayAddText ( serverDisplay, serverText ) setTimer ( textDestroyTextItem, 5000, 1, serverText ) setTimer ( textDestroyDisplay, 5000, 1, serverDisplay ) end addEventHandler ("onPlayerJoin", getRootElement(), showTextDisplay) Link to comment
NameThatGuy Posted July 31, 2011 Share Posted July 31, 2011 Do you mean like, when someone join, it's going to be like; "Welcome, username"? Link to comment
KITT1995 Posted July 31, 2011 Author Share Posted July 31, 2011 Do you mean like, when someone join, it's going to be like; "Welcome, username"? Yes, like that Link to comment
Uisaqin Posted July 31, 2011 Share Posted July 31, 2011 function showTextDisplay ( source, command ) function showTextDisplay ( ) https://wiki.multitheftauto.com/wiki/OnPlayerJoin Link to comment
Castillo Posted July 31, 2011 Share Posted July 31, 2011 function showTheText ( ) local serverDisplay = textCreateDisplay() textDisplayAddObserver ( serverDisplay, source ) local serverText = textCreateTextItem ( "Downloading new vehicles!", 0.5, 0.0, 2, 0, 255, 255, 255, 5, "center", "top" ) textDisplayAddText ( serverDisplay, serverText ) setTimer ( textDestroyTextItem, 5000, 1, serverText ) setTimer ( textDestroyDisplay, 5000, 1, serverDisplay ) end addEventHandler ("onPlayerJoin", getRootElement(), showTheText) Link to comment
KITT1995 Posted July 31, 2011 Author Share Posted July 31, 2011 function showTheText ( ) local serverDisplay = textCreateDisplay() textDisplayAddObserver ( serverDisplay, source ) local serverText = textCreateTextItem ( "Downloading new vehicles!", 0.5, 0.0, 2, 0, 255, 255, 255, 5, "center", "top" ) textDisplayAddText ( serverDisplay, serverText ) setTimer ( textDestroyTextItem, 5000, 1, serverText ) setTimer ( textDestroyDisplay, 5000, 1, serverDisplay ) end addEventHandler ("onPlayerJoin", getRootElement(), showTheText) It works!! But how I can put the text up to the screen? In freeroam the map that appear when u join the server, hide the text. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now