Jump to content

Help_Shout


Recommended Posts

Hey i use This Resources , which allow me to Send Message to all players i need just help in . Like i /shout Hello

ineed to outPutChatBox Hello

and i need getPlayerName like if some one called Carmen Shouted it seems like that Carmen : Hello

this shout belongs to SolidSnake

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("shout", shout) 

Link to comment

Use the following:

function shout(thePlayer, cmd, ...) 
    local accountname = tostring(getAccountName(getPlayerAccount(thePlayer))) --Get the player's account name 
    if isObjectInACLGroup("user."..accountname, aclGetGroup("Admin")) then --Check if he is in an admin 
        local msg = table.concat({...}, " ") --Form the ... into a string by table.concat 
        if msg and msg ~= "" then --If msg isn't empty 
            msg = getPlayerName(thePlayer)..': '..msg --Add the player's name to the msg 
            outputChatBox(msg, root, 205, 0, 0) --output the message to everyone 
        end 
    end 
  
end 
addCommandHandler("shout", shout) 

Link to comment

look i use this but i want player name be shown in shout like

[FO]Name : Hello

function shout ( player, cmd, ... ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        local message = table.concat ( { ... }," " ) 
        local name = getPlayerName(player) 
        local r, g, b = getPlayerNametagColor(player) 
        textDisplay = textCreateDisplay ( ) 
        outputChatBox ( "#FF0000(Shoutall) "..name..": #FFFFFF".. message, root, r, g, b, true ) 
        textItem = textCreateTextItem (message, 0.5, 0.5, 2, 225, 0, 0, 255, 4, "center", "center", 50 ) 
        textDisplayAddText ( textDisplay, textItem ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            textDisplayAddObserver ( textDisplay, thePlayer ) 
        end 
        setTimer ( 
            function ( ) 
                textDestroyTextItem ( textItem ) 
                textDestroyDisplay ( textDisplay ) 
            end 
            ,10000, 1 
        ) 
    else 
        outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) 
    end 
end 
addCommandHandler ( "shoutall", shout ) 

Link to comment

Does this work for you?

function shout ( player, cmd, ... ) 
    local accountname = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        local message = table.concat ( { ... }," " ) 
        local name = getPlayerName(player) 
        local r, g, b = getPlayerNametagColor(player) 
        textDisplay = textCreateDisplay ( ) 
        outputChatBox ( "#FF0000(Shoutall) [FO]"..name..": #FFFFFF".. message, root, r, g, b, true ) 
        message = '[FO]'..name..': '..message 
        textItem = textCreateTextItem (message, 0.5, 0.5, 2, 225, 0, 0, 255, 4, "center", "center", 50 ) 
        textDisplayAddText ( textDisplay, textItem ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            textDisplayAddObserver ( textDisplay, thePlayer ) 
        end 
        setTimer ( 
            function ( ) 
                textDestroyTextItem ( textItem ) 
                textDestroyDisplay ( textDisplay ) 
            end 
            ,10000, 1 
        ) 
    else 
        outputChatBox ( "You cannot use this command!", player, 255, 12, 15 ) 
    end 
end 
addCommandHandler ( "shoutall", shout ) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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