Jump to content

how to...


Sparrow

Recommended Posts

Posted

I do admin chat script hours ago, it work well but my problem is how set the text in admin chat showed only for admins (admin and moderators)

I try but I fail, nothing won't work, what is the function needed for this?

thanks

Posted

Post your code, how do you expect us to help you if you don't.

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

this is it:

function adminChat(thePlayer,_,...) 
    local text = table.concat({...}, "") 
    local name = getPlayerName(thePlayer) 
    local accName = getAccountName (getPlayerAccount (thePlayer)) 
    if (isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
        outputChatBox ("#FF0000(Admin Chat) "..name..": #FFFFFF"..text, getRootElement(), 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 

Posted
function adminChat(thePlayer,_,...) 
    local text = table.concat({...}, " ") 
    local name = getPlayerName(thePlayer) 
    local accName = getAccountName (getPlayerAccount (thePlayer)) 
    if ( isObjectInACLGroup ("user.".. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
        for index, player in ipairs(getElementsByType("player")) do 
            local accName = getAccountName (getPlayerAccount (player)) 
            if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) ) then 
                outputChatBox ("#FF0000(Admin Chat) "..tostring(name)..": #FFFFFF"..tostring(text), player, 255, 255, 255, true) 
            end 
        end 
    end 
end 
addCommandHandler("ac", adminChat) 

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

My bad, I forgot to change something, copy it again.

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

Try

function adminChat( thePlayer,_,... ) 
    local text = table.concat( {...}, "" ) 
    local name = getPlayerName( thePlayer ) 
    for _,v in pairs( getPlayersInGroup( accName ) ) do 
         outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 
  
function getPlayersInGroup( accName ) 
    local Table = { } 
    for _,v in pairs( getElementsByType( "player" ) ) do 
        local accName =  getAccountName ( getPlayerAccount ( v ) ) 
        if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "SuperModerator" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "Moderator" ) ) then 
                table.insert( Table,v )     
        end 
    end 
    return Table 
end 

Code updated recheck it

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

this code..

will not work "spaces"

"I will kill u"

only - "iwillkillu"

357ac0078264.jpg

- Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]

Posted

True, use this:

function adminChat( thePlayer,_,... ) 
    local text = table.concat( {...}, " " ) 
    local name = getPlayerName( thePlayer ) 
    for _,v in pairs( getPlayersInGroup( accName ) ) do 
         outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("ac", adminChat) 
  
function getPlayersInGroup( accName ) 
    local Table = { } 
    for _,v in pairs( getElementsByType( "player" ) ) do 
        local accName =  getAccountName ( getPlayerAccount ( v ) ) 
        if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "SuperModerator" ) ) or 
            isObjectInACLGroup ( "user." .. tostring(  accName ), aclGetGroup ( "Moderator" ) ) then 
                table.insert( Table,v )     
        end 
    end 
    return Table 
end 

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.

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...