chojrak
Banned User
- Joined
- Oct 25, 2008
- Messages
- 5,832
- Solutions
- 2
- Reaction score
- 160
Hello! I've written an onJoinChannel example, script will display users list of Help Channel when you join and if your access is higher than 2.
creaturescripts.xml:
Note: I don't use getGroupInfo(), cause here you can use shortcuts like "GM", "CM" etc. :>
Code:
function onJoinChannel(cid, channelId, users)
if (channelId == CHANNEL_HELP) then
-- Prepare locals.
local list = {}
local message = "[GM Info] Users on help"
local ranks = {"Player", "Tutor", "Senior Tutor", "Game Master", "Community Manager", "GOD"}
-- Push user names into `list` table.
for i = 1, #users do
local access = getPlayerAccess(users[i])
local rank = "Unknown"
if (ranks[access+1]) then
rank = ranks[access+1]
end
list[i] = getCreatureName(users[i]) .. " [".. rank .."]"
end
-- Create message using `list` table.
for i = 1, #list do
if i == 1 then
message = message .. " : ".. list[i] ..""
else
message = message .. ", ".. list[i] ..""
end
end
-- Check access and send message.
if (getPlayerAccess(cid) >= 3) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, message)
end
end
return TRUE
end
creaturescripts.xml:
Code:
<event type="joinchannel" name="Help" event="script" value="help.lua"/>
Note: I don't use getGroupInfo(), cause here you can use shortcuts like "GM", "CM" etc. :>
Last edited: