• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] Helper Effect

Wason

UnKnow Member
Joined
Jan 12, 2015
Messages
1,249
Reaction score
255
Location
EgypT
hello guys,
i need the whole staff when they are group 2 , 3 they up like VIP! To be effect Like Helper!
can someone help me please??

tfs 0.3.6 // version 8.60
~~~~~~~~

Here you Are The Script.
~~~~
function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers()) do
local cid = getPlayerByName(name)
if getPlayerStorageValue(cid, 11551) >= 1 then
doSendMagicEffect(getPlayerPosition(cid), 22)
doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
end
end
return true
end


Can Someone From STaff Member Help Me?!
@Limos @Ninja @Printer @Summ
 
ofc. u need to change groups id as u want or add them as u want
long code but easy for u to edit
i didn't use v or k or i , etc xD
Code:
local group = getPlayerGroupId(cid)
local cid = getPlayerByName(name)

function onThink(interval, lastExecution)
    for _, name in ipairs(getOnlinePlayers()) do
        if group == 1 then
            doSendAnimatedText(getPlayerPosition(cid), "Player", TEXTCOLOR_RED)
        elseif group == 2 then
            doSendAnimatedText(getPlayerPosition(cid), "Tutor", TEXTCOLOR_RED)
        elseif group == 3 then
            doSendAnimatedText(getPlayerPosition(cid), "Senior Tutor", TEXTCOLOR_RED)
        elseif group == 4 then
            doSendAnimatedText(getPlayerPosition(cid), "Game Master", TEXTCOLOR_RED)
        elseif group == 5 then
            doSendAnimatedText(getPlayerPosition(cid), "Community Manager", TEXTCOLOR_RED)
        elseif group == 6 then
            doSendAnimatedText(getPlayerPosition(cid), "Administrator", TEXTCOLOR_RED)                   
        end
    end
return true
end
 
Edit: I like to make it pretty :)
Code:
local player = { "Player", "Tutor", "Senior Tutor", "Game Master", "Community Manager", "Administrator" }
local color = {
    TEXTCOLOR_RED, -- player
    TEXTCOLOR_RED, -- tutor
    TEXTCOLOR_RED, -- senior tutor
    TEXTCOLOR_RED, -- game master
    TEXTCOLOR_RED, -- community manager
    TEXTCOLOR_RED -- administrator
}

function onThink(cid, interval)
    local playersOnline = getPlayersOnline()
    for _, cid in ipairs(playersOnline) do
        for i = 1, #player do
            if getPlayerGroupId(cid) == i then
                doSendAnimatedText(getPlayerPosition(cid), player[i], color[i])
            end
        end
    end
    return true
end
 
Last edited:
Code:
local player = { "Player", "Tutor", "Senior Tutor", "Game Master", "Community Manager", "Administrator"}
local color = {
    TEXTCOLOR_RED -- player
    TEXTCOLOR_RED -- tutor
    TEXTCOLOR_RED -- senior tutor
    TEXTCOLOR_RED -- game master
    TEXTCOLOR_RED -- community manager
    TEXTCOLOR_RED -- administrator
}

function onThink(cid, interval)
    for _, cid in ipairs(getPlayersOnline()) do
       for i = 1, #player do
            if getPlayerGroupId(cid) == i then
                doSendAnimatedText(getPlayerPosition(cid), player[i], color[i])
            end
      end
    end
    return true
end

i make it simple for him :D
 
So demanding :(
Code:
local player = { [2] = "Tutor", [3] = "Senior Tutor" }
local color = {
   [2] = TEXTCOLOR_RED, -- tutor
   [3] = TEXTCOLOR_RED -- senior tutor
}

function onThink(cid, interval)
    local playersOnline = getPlayersOnline()
    for _, cid in ipairs(playersOnline) do
        for i = 2, #player + 3 do
            if getPlayerGroupId(cid) == i then
                doSendAnimatedText(getPlayerPosition(cid), player[i], color[i])
            end
        end
    end
    return true
end
 
Code:
local player = { [2] = "Tutor", [3] = "Senior Tutor" }
local color = {
   [2] = TEXTCOLOR_RED, -- tutor
   [3] = TEXTCOLOR_RED -- senior tutor
}

function onThink(cid, interval)
    local playersOnline = getPlayersOnline()
    for _, cid in ipairs(playersOnline) do
        for i = 2, #player + 3 do
            if getPlayerGroupId(cid) == i then
                doSendAnimatedText(getPlayerPosition(cid), player[i], color[i])
                doSendMagicEffect(getPlayerPosition(cid), 22)
            end
        end
    end
    return true
end
 
I would rather use an onLogin script than global event.

Code:
local config = {
    [2] = {name = "Tutor", color = TEXTCOLOR_RED, magicEffect = CONST_ME_SOUND_YELLOW},
    [3] = {name = "Senior Tutor", color = TEXTCOLOR_RED, magicEffect = CONST_ME_SOUND_YELLOW}
}

local function sendHelperEffect(cid)
    if not isPlayer(cid) then
        return
    end

    local group = config[getPlayerGroupId(cid)]
    if not group then
        return
    end

    doSendAnimatedText(getPlayerPosition(cid), group.name, group.color)
    doSendMagicEffect(getPlayerPosition(cid), group.magicEffect)
    addEvent(sendHelperEffect, 5000, cid)
end

function onLogin(cid)
    sendHelperEffect(cid)
    return true
end
 
The addEvent is better in this case because it does not iterate through getOnlinePlayers() every time it's executed, and will stop if the conditions are not met. :p
 
Back
Top