Tekken Posted October 18, 2014 Share Posted October 18, 2014 Hi guys i added a mute verification on globalchat but is not working function globalMessage(thePlayer, cmd, ...) if isPlayerMuted ( playersource ) then outputChatBox ("You are muted!", playersource, 255, 128, 22, true) return end local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer); local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("#DEFF00#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return end if isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then outputChatBox("#DEFF00#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return else outputChatBox("#00E6FF#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return end end addCommandHandler("global", globalMessage); addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"x", "down", "chatbox", "global"); end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "x", "down", "chatbox", "global"); end ) Link to comment
Anubhav Posted October 18, 2014 Share Posted October 18, 2014 function globalMessage(thePlayer, cmd, ...) if isPlayerMuted ( thePlayer ) then outputChatBox ("You are muted!", thePlayer, 255, 128, 22, true) return end local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer); local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("#DEFF00#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return end if isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then outputChatBox("#DEFF00#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return else outputChatBox("#00E6FF#FFFFFF"..name..": #FFFFFF"..message,root, 255, 255, 255, true) return end end addCommandHandler("global", globalMessage); addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"x", "down", "chatbox", "global"); end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "x", "down", "chatbox", "global"); end ) Link to comment
Mr_Moose Posted October 18, 2014 Share Posted October 18, 2014 Line 2: 'playersource' does not point on the player, 'thePlayer' does that, Anubhav fixed it for you. If it still doesn't work, try '/debugscript 3' which will expose that kind of issues. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now