Jump to content

help with script admin chat box


IIIIlllllIII

Recommended Posts

hi i have admin script for chat box

when the admin type somehting in the chat box all players see the admin name like

when i type in the chat see this

admin-MOJRM-511

see the code

  
  
addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if hasObjectPermissionTo ( source , "function.banPlayer" ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Admin]-#ffffff" .. getPlayerName ( source ) .. ":" .. message, getRootElement(), r, g, b, true ) 
end 
end) 
  
  

and all works great

but the problem i cant make script for modrator only admin

if i but function.banPlayer all the admin and modrator in the chat box be admin

i wanna make script for modrator only modrator

when i set function.banPlayer if im admin and modrator i see the same in the chat box

i wanna make it for modrator all the function in the acl admin and acl moderator

pleeeez help me for make this script

i still all my day to make it work for moderator and super modrator

pleeez help me the wiki dont help me

Link to comment

man im noob in script but we try :D

do you mean this

for admin

  
  
  
addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if isObjectInACLGroup ( source , "admin" ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Admin]-#ffffff" .. getPlayerName ( source ) .. ":" .. message, getRootElement(), r, g, b, true ) 
end 
end) 
  
  
  
  
  

for moderator

  
  
  
addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if isObjectInACLGroup ( source , "moderator" ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ":" .. message, getRootElement(), r, g, b, true ) 
end 
end) 
  
  
  
  
  

did i do the true :D or no

Link to comment

this dont working

i test this

  
  
  
  
addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "Moderator" ) ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
end) 
  

i have erorr in script i test wiki i said wiki dont help me

any one help me pleez

Link to comment

That's because you must use the player's account name, not his nick name.

addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
end) 

Link to comment
  
addEventHandler ( "onPlayerChat" , root , 
function ( message , type ) 
if type == 0 then 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) then 
cancelEvent ( ) 
local r, g, b = getPlayerNametagColor(source) 
outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
end 
end 
end) 
  

@Solidsnake14 Missed "if type == 0 then" it means we can speak in team

Link to comment
addEventHandler ( "onPlayerChat", root, 
function ( message, type ) 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) and type == 0 then 
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) and type == 0 then    
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ( "#00FF00[Admin]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
    end 
end) 

Works fine here.

Link to comment
addEventHandler ( "onPlayerChat", root, 
function ( message, type ) 
if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) and type == 0 then 
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ( "#00FF00[Moderator]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) and type == 0 then    
    cancelEvent ( ) 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ( "#00FF00[Admin]-#ffffff" .. getPlayerName ( source ) .. ": " .. message, getRootElement(), r, g, b, true ) 
    end 
end) 

Works fine here.

man you the best thank you so mutch how many time you helping me

you are the king of the scripter

works great thank you my friend you the king of scripter :D

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