Jump to content

*WANTED* Script


Einheit-101

Recommended Posts

Posted

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.

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted

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> 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

easy, we learn for long time and get help from forums like others then we help others, etc, etc. :P

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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) 
  

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted

locked under request

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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