Jump to content

*WANTED* Script


Einheit-101

Recommended Posts

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

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

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
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...