• 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!

VIP Effect for 1.2

Zombiegod

Active Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
25
Solution
Lua:
local TextColor = 198
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        local t = player:getPosition()
        if player:isVip() then
            doSendAnimatedText("VIP", t, TextColor)
        end
    end
    return true
end

Alternative version with colors changing. And doing an alternative solution for staff members.
Lua:
local cfg = {
colors = {5,30,35,95,108,129,143,155,180,198,210,215}, -- You can add more colors.
NotifyStaff = true, -- true/false display STAFF popup on GM Chars.
StaffMessage = "STAFF", -- Message to display on staff members.
VIPMessage = "VIP", -- Message to display on VIP members.
RandomizeColor =...
i am having issues with adding a vip effect using global events.
you forgot to tell us what is the issue that you are having

hmm

anyways, maybe try something like
Lua:
for _, name in ipairs(Game.getPlayers()) do
        local char = player:getName(name)
    if char:getStorageValue(cid, 12151) >= 1 then
      -- do ur nifty animated text
 
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/vipEffect.lua:onThink
data/globalevents/scripts/vipEffect.lua:3: attempt to index global 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/globalevents/scripts/vipEffect.lua:3: in function <data/globalevents/scripts/vipEffect.lua:1>
[Error - GlobalEvents::think] Failed to execute event: vipEffect
Post automatically merged:

just to clarify i do have player
Lua:
function onThink(words, player, cid, param, interval)
for _, name in ipairs(Game.getPlayers()) do
        local char = player:getName(name)
    if char:getStorageValue(cid, 12151) >= 1 then
      -- do ur nifty animated text
                  doSendMagicEffect(CONST_ME_POFF)
                  doSendAnimatedText("VIP", getPlayerPosition(cid), TEXTCOLOR_RED)
    end
    end
        
         return true
end

or i do


Lua:
function onThink(words, cid, param, interval)
local player = Player(cid)
for _, name in ipairs(Game.getPlayers()) do
        local char = player:getName(name)
    if char:getStorageValue(cid, 12151) >= 1 then
      -- do ur nifty animated text
                  doSendMagicEffect(CONST_ME_POFF)
                  doSendAnimatedText("VIP", getPlayerPosition(cid), TEXTCOLOR_RED)
    end
    end
        
         return true
end

same result
 
Lua:
local TextColor = 198
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        local t = player:getPosition()
        if player:isVip() then
            doSendAnimatedText("VIP", t, TextColor)
        end
    end
    return true
end

Alternative version with colors changing. And doing an alternative solution for staff members.
Lua:
local cfg = {
colors = {5,30,35,95,108,129,143,155,180,198,210,215}, -- You can add more colors.
NotifyStaff = true, -- true/false display STAFF popup on GM Chars.
StaffMessage = "STAFF", -- Message to display on staff members.
VIPMessage = "VIP", -- Message to display on VIP members.
RandomizeColor = true, -- true/false randomly generate colors.
color = 198 -- Color if randomized color is false.
}

function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local t = player:getPosition()
        if cfg.RandomizeColor then
            local c = math.random(#cfg.colors)
        else
            local c = cfg.color
        end
        if player:isInGhostMode() then
            return true
        end
        if player:getGroup():getAccess() then
            if cfg.NotifyStaff then
                doSendAnimatedText(cfg.StaffMessage, t, c)
            end
        return true
        end
        if player:isVip() then
            doSendAnimatedText(cfg.VIPMessage, t, c)
        end
    end
    return true
end
 
Last edited:
Solution
Had to do a little tweaking to get it to work, but it worked !!!! Thanks so much!

Lua:
local TextColor = 198
local VIPStorage = 121212
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local t = player:getPosition()
        if player:isVip() then
            doSendAnimatedText("VIP", t, TextColor)
        end
    end
    return true
end
 
Edited my previous post for future refrence.
alrighty, i also added in blocking the text if the player is ghosted.


Code:
local TextColor = 198
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local t = player:getPosition()
        if player:isInGhostMode() then
        return true
        end
        if player:isVip() then
            doSendAnimatedText("VIP", t, TextColor)
        end
    end
    return true
end
 
Back
Top