-.Paradox.- Posted July 24, 2013 Share Posted July 24, 2013 Hello, i have this script, its working fine but one thing is missing, When admin do /shoutall "msg" the message must appear in chatbox like that, SHOUTALL:"msg" here is the code function shout(player, cmd, ...) local accountname = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then for id, players in ipairs(getElementsByType("player")) do local message = table.concat({...}," ") local textDisplay = textCreateDisplay () local nombre = getPlayerName(player) local textItem = textCreateTextItem( ""..message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( textDisplay, textItem ) textDisplayAddObserver ( textDisplay, players ) setTimer ( textDestroyTextItem, 5000, 1, textItem ) setTimer ( textDestroyDisplay, 5000, 1, textDisplay ) end else outputChatBox("You cannot use this command!",player,255,12,15) end end addCommandHandler("SHOUTALL", shout) Thanks for help Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 2013 function shout ( player, cmd, ... ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then local message = table.concat ( { ... }," " ) outputChatBox ( "SHOUTALL: ".. message, root, 205, 0, 0 ) else outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) end end addCommandHandler ( "SHOUTALL", shout ) Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Thanks working fine Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Worked fine. but when i restarted server it wont show The message, it show only in chat box. Thanks for youre help Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 It wont show the message in screen, but it show in the chatbox. Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 nope i want it to show in screen & chatbox. Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 2013 function shout ( player, cmd, ... ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then local message = table.concat ( { ... }," " ) textDisplay = textCreateDisplay ( ) outputChatBox ( "SHOUTALL: ".. message, root, 205, 0, 0 ) textItem = textCreateTextItem ( message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( textDisplay, textItem ) for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do textDisplayAddObserver ( textDisplay, thePlayer ) end setTimer ( function ( ) textDestroyTextItem ( textItem ) textDestroyDisplay ( textDisplay ) end ,5000, 1 ) else outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) end end addCommandHandler ( "SHOUTALL", shout ) Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Warning: Shoutall/shoutall.lua:14: Bad argument@ 'testDisplayAddObServer' Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Working perfect thanks 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