Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
basically I am trying to make a world chat with guild name beside player's name. If staff member [staff].
As of right now, the guild name is working, but if the player has no guild the [staff] tag is applied to a normal player.
Code:
Example:
Caduceus [Guild] [Staff]: message - which is working.
Player [Guild]: message - which is working as long as player has a guild.
As of right now, the guild name is working, but if the player has no guild the [staff] tag is applied to a normal player.
Code:
local CHANNEL_HELP = 3
local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
muted:setParameter(CONDITION_PARAM_TICKS, 3600000)
function onSpeak(player, type, message)
local playerAccountType = player:getAccountType()
local staff = player:getGroup():getAccess()
local guild = player:getGuild()
local info = "staff"
type = TALKTYPE_CHANNEL_Y
if staff then
if guild then
info = info .. "][" .. guild:getName()
end
type = TALKTYPE_CHANNEL_O
else
if guild then
info = guild:getName()
end
sendChannelMessage(3, type, player:getName() .. " [" .. info .. "]: " .. message)
return false
end
local player = Player(cid)
if not player then
return true
end
if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
player:sendCancelMessage("You are muted from the World Chat for using it inappropriately.")
return false
end
if playerAccountType >= ACCOUNT_TYPE_TUTOR then
if string.sub(message, 1, 6) == "!mute " then
local targetName = string.sub(message, 7)
local target = Player(targetName)
if target ~= nil then
if playerAccountType > target:getAccountType() then
if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
target:addCondition(muted)
sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been muted by " .. player:getName() .. " for using the World Chat inappropriately.")
else
player:sendCancelMessage("That player is already muted.")
end
else
player:sendCancelMessage("You are not authorized to mute that player.")
end
else
player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
end
return false
elseif string.sub(message, 1, 8) == "!unmute " then
local targetName = string.sub(message, 9)
local target = Player(targetName)
if target ~= nil then
if playerAccountType > target:getAccountType() then
if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".")
else
player:sendCancelMessage("That player is not muted.")
end
else
player:sendCancelMessage("You are not authorized to unmute that player.")
end
else
player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
end
return false
end
end
end
Last edited: