-.Paradox.- Posted May 3, 2014 Posted May 3, 2014 Hello, How i can use the following to display a "math.random" numbers and make it disappear after 6 seconds? Like example if i killed somebody a text with a random number will appear and after 6 seconds exactly it will disappear, thanks. textDisplayAddObserver textDisplayAddText textDestroyDisplay textDestroyTextItem Server (not tested): function text(player) local test = math.random(100, 200) local serverDisplay = textCreateDisplay() textDisplayAddObserver ( serverDisplay, player ) local serverText = textCreateTextItem ( tonumber(test), 0.5, 0.5 ) textDisplayAddText ( serverDisplay, serverText ) addEventHandler("onPlayerWasted", root, text) setTimer ( text, 6000, 1, textDestroyDisplay ( serverDisplay ) textDestroyTextItem( serverText ) ) end If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Arnold-1 Posted May 3, 2014 Posted May 3, 2014 remove player at line 1, and replace player inside the function with source. and put the timer inside the function and make another function inside it with textDestroyDisplay and textDestroyItem. so it will be like: function text () local test = math.random(100, 200) local serverDisplay = textCreateDisplay() textDisplayAddObserver ( serverDisplay, source) local serverText = textCreateTextItem ( tonumber(test), 0.5, 0.5 ) textDisplayAddText ( serverDisplay, serverText ) setTimer(function () textDestroyDisplay ( serverDisplay ) textDestroyTextItem( serverText ) end,6000,1) end addEventHandler("onPlayerWasted",root,text) Ingame Name: Arnold If you need my help, contact me on Skype @bshr.ara NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP
-.Paradox.- Posted May 3, 2014 Author Posted May 3, 2014 Source won't create the text for all the players on the server? If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Saml1er Posted May 3, 2014 Posted May 3, 2014 function text () local test = math.random(100, 200) local serverDisplay = textCreateDisplay() for _,v in pairs (getElementsByType("player") ) do -- loop through all players textDisplayAddObserver ( serverDisplay, v) end -- loop ends local serverText = textCreateTextItem ( tonumber(test), 0.5, 0.5 ) textDisplayAddText ( serverDisplay, serverText ) setTimer(function () textDestroyDisplay ( serverDisplay ) textDestroyTextItem( serverText ) end,6000,1) end addEventHandler("onPlayerWasted",root,text) btw source is the player who died so it will create text only for the player and the code I posted below will display text for all players.
-.Paradox.- Posted May 3, 2014 Author Posted May 3, 2014 Thanks gonna try If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
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