if getPlayerGroupId(cid) ==3 thenIf i want the effect for an admin, i use group 6?
Yea i mean this xDif getPlayerGroupId(cid) ==3 then
If you mean this^ yes
you can edit it if you want, i just saw it in highexp so i thought it would be nice if i share it with everyone, i'm not sure if it will work i didn't have time to test it so, just post errors if there are any !
Lua:function onThink(interval, lastExecution) for _, name in ipairs(getOnlinePlayers()) do local cid = getPlayerByName(name) if getPlayerGroupId(cid) ==3 then doSendMagicEffect(getPlayerPosition(cid), 27) doSendAnimatedText(getPlayerPosition(cid), "HELPER", TEXTCOLOR_RED) end end return true end
please go easy on me I'm still a beginner I'm just trying to be helpful here, also to examine myself in what i've learned/read
And what should I wrote down in Globalevents note?, I copied this Code to Lua note and how to make it worked?
<globalevent name="TutorEffect" interval="1" event="script" value="FILENAME.lua"/>
function onThink(interval)
players = Game.getPlayers()
for i, v in ipairs(players) do
player = Player(players[i])
if player:getAccess() >= 3 then
player:say("Staff", TALKTYPE_MONSTER_SAY, 0, 1, player:getPosition())
player:getPosition():sendMagicEffect(10)
end
end
return true
end
for TFS 1.x
Lua:function onThink(interval) players = Game.getPlayers() for i, v in ipairs(players) do player = Player(players[i]) if player:getAccess() >= 3 then player:say("Staff", TALKTYPE_MONSTER_SAY, 0, 1, player:getPosition()) player:getPosition():sendMagicEffect(10) end end return true end
local cfg = {
[1] = {"Tutor", CONST_ME_MAGIC_RED},
[2] = {"Gamemaster", CONST_ME_MAGIC_BLUE},
[3] = {"Admin", CONST_ME_MAGIC_GREEN}
}
function onThink(interval)
local players = Game.getPlayers()
for _, player in ipairs(players) do
local effect = cfg[player:getGroup():getAccess()]
if effect then
player:say(effect[1], TALKTYPE_MONSTER_SAY)
player:getPosition():sendMagicEffect(effect[2])
end
end
return true
end
local fag = {
[1] = {name = "Static_", age = 10, life_status = "Bitch Boy"}
}
okLua:local fag = { [1] = {name = "Static_", age = 10, life_status = "Bitch Boy"} }
Jk, I haven't done any coding in a long time didn't think of the most efficient way to do it. Thanks for correcting it.
function onThink(interval, lastExecution)
for k, v in pairs(getPlayersOnline()) do
if getPlayerGroupId(v) == 3 and not isPlayerGhost(v) then
if getPlayerStorageValue(v, 15612) == 1 then
doSendMagicEffect(getPlayerPosition(v), CONST_ME_GIFT_WRAPS)
doSendAnimatedText(getPlayerPosition(v), "Tutor", TEXTCOLOR_RED)
end
end
end
return true
end
function onSay(cid, words, param, channel)
if getPlayerAccess(cid) > 3 then
if getPlayerStorageValue(cid, 15612) == 1 then
setPlayerStorageValue(cid, 15612, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Automatic Message: OFF")
else
setPlayerStorageValue(cid, 15612, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Automatic Message: ON")
end
end
return true
end