Einheit-101 Posted October 18, 2010 Share Posted October 18, 2010 Hello Dears, i am looking for a script that outputs a Display message (like Admin Shout) to ALL players. Here is my code: addEventHandler( "onClientRender", getRootElement( ), function ( wanted ) local instructions = guiCreateLabel ( 0, 0.2, 1, 0.5, "5000$ REWARD FOR KILLING EINHEIT-666 OR 101", true ) guiSetFont ( instructions, "Arial" ) guiLabelSetColor ( instructions, 255, 0, 0 ) guiLabelSetHorizontalAlign ( instructions, "center", false ) setTimer ( destroyElement, 10000, 1, instructions ) end ) The Problem is the GUI. I have tried to make a GUI that opens and you can put your message there. How to make that? thanks. Link to comment
Castillo Posted October 18, 2010 Share Posted October 18, 2010 i've made a admin shout fully server side in the past for a server, here is the code if you want it, server.lua: 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 textItem2 = textCreateTextItem( ""..nombre, 0.5, 0.4, 2, 0, 255, 0, 255, 4, "center", "center" ) local textItem = textCreateTextItem( ""..message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( textDisplay, textItem ) textDisplayAddText ( textDisplay, textItem2 ) textDisplayAddObserver ( textDisplay, players ) setTimer ( textDestroyTextItem, 5000, 1, textItem ) setTimer ( textDestroyTextItem, 5000, 1, textItem2 ) setTimer ( textDestroyDisplay, 5000, 1, textDisplay ) else outputChatBox("You can not use this commad!",player,255,12,15) end end end addCommandHandler("shout", shout) meta.xml: <meta> <info name="Admin shout" author="Castillo" version="1.0" type="script" /> <script src="server.lua" type="server"/> </meta> Link to comment
Einheit-101 Posted October 18, 2010 Author Share Posted October 18, 2010 Wow snake, thanks a lot!!! I am really wondering how you guys script those things without problems Link to comment
Castillo Posted October 18, 2010 Share Posted October 18, 2010 easy, we learn for long time and get help from forums like others then we help others, etc, etc. Link to comment
dzek (varez) Posted October 18, 2010 Share Posted October 18, 2010 if you are patient and you really want to learn - its not a problem. https://wiki.multitheftauto.com/ - the is Scripting box there. Check Introduction to scripting. Link to comment
Einheit-101 Posted October 18, 2010 Author Share Posted October 18, 2010 OKAY TOPIC CAN BE CLOSED!!! Snake, your code had an error^^ a end was missing in line 16^^ FINAL 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 textItem2 = textCreateTextItem( ""..nombre, 0.5, 0.4, 2, 0, 255, 0, 255, 4, "center", "center" ) local textItem = textCreateTextItem( ""..message, 0.5, 0.5, 2, 205, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( textDisplay, textItem ) --textDisplayAddText ( textDisplay, textItem2 ) textDisplayAddObserver ( textDisplay, players ) setTimer ( textDestroyTextItem, 5000, 1, textItem ) --setTimer ( textDestroyTextItem, 5000, 1, textItem2 ) setTimer ( textDestroyDisplay, 5000, 1, textDisplay ) end else outputChatBox("You can not use this commad!",player,255,12,15) end end addCommandHandler("shout", shout) Link to comment
dzek (varez) Posted October 18, 2010 Share Posted October 18, 2010 locked under request Link to comment
Recommended Posts