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

TFS 1.X+ Vip System effect on the player

Magicalx

Banned User
Joined
Jul 6, 2022
Messages
56
Reaction score
9
GitHub
Magicalx
I want an effect on the player can you help me create a script like this to work with this system \/

Lua:
<globalevent name="vipEffect" interval="5000" script="vipEffect.lua"/>
Code:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerVipDays(cid) >= 1 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doPlayerSetRate(cid, SKILL__LEVEL, 1)
                  doSendAnimatedText(getPlayerPosition(cid), "{VIP}", TEXTCOLOR_RED)
               end
         end
         return true
end
There is another thing. If someone can help me, this system gives all the VIPs. If it's on one person's account, use VIP. I want to use it for one character, not for the whole account. Thank you in advance
 
Solution
It tells u the error alredy

Lua:
local effect = 1

function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end
Lua:
local VIPeffect = GlobalEvent("VIP Effect")

local effect = 1

function VIPeffect.onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end

VIPeffect:interval(5000)
VIPeffect:register()
 
Lua:
local VIPeffect = GlobalEvent("VIP Effect")

local effect = 1

function VIPeffect.onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end

VIPeffect:interval(5000)
VIPeffect:register()
Lua:
Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
data/globalevents/scripts/vipEffect.lua:1: attempt to call global 'GlobalEvent' (a nil value)
stack traceback:
        [C]: in function 'GlobalEvent'
        data/globalevents/scripts/vipEffect.lua:1: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/vipEffect.lua
Tfs 1.2
 
XML:
<globalevent name="vipeffect" interval="1000" script="VIP.lua" />

Lua:
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end

Since u cant change from revscript to xml/lua by urself
please change ur distro
dont waste ur time with tfs 1.2
 
Since u cant change from revscript to xml/lua by urself
please change ur distro
dont waste ur time with tfs 1.2
If me can, why i asking for help?
If you can help me with the second thing that would be fine anyway thank you
Post automatically merged:

XML:
<globalevent name="vipeffect" interval="1000" script="VIP.lua" />

Lua:
function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end

Since u cant change from revscript to xml/lua by urself
please change ur distro
dont waste ur time with tfs 1.2

at:
[C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
ERROR: invalid effect id 0
Lua:
ProtocolGame parse message exception (76 bytes, 57 unread, last opcode is 0xaa (170), prev opcode is 0xffffffff (-1), proto: 800): unknown message mode 0
50 00 48 00
aa 80 02 00 00 05 00 41 64 6d 69 6e 19 11 00 e2 03 e5 03 07 07 00 7b 56 2e 49 2e 50 7d 83 e2 03 e5 03 07 00 aa 82 02 00 00 05 00 50 61 77 6c 6f c8 04 00 e2 03 e4 03 07 07 00 7b 56 2e 49 2e 50 7d 83 e2 03 e4 03 07 00
Debug
 
Last edited:
It tells u the error alredy

Lua:
local effect = 1

function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:isInGhostMode() then
            return true
        end
        if player:isVip() then
            local pos = player:getPosition()
            player:say("V.I.P", TALKTYPE_MONSTER_SAY)
            pos:sendMagicEffect(effect)
        end
    end
    return true
end
 
Solution
Would it be possible to add more colors to the text?
I tried to adapt it with animated text but I only got 1 color
thanks!

function onThink(interval)
for _, player in ipairs(Game.getPlayers()) do
if player:isInGhostMode() then
return true
end
if player:isVip() then
local pos = player:getPosition()
Game.sendAnimatedText("{VIP}", pos,TEXTCOLOR_RED)
pos:sendMagicEffect(effect)
end
end
return true
end
 
Would it be possible to add more colors to the text?
I tried to adapt it with animated text but I only got 1 color
thanks!

function onThink(interval)
for _, player in ipairs(Game.getPlayers()) do
if player:isInGhostMode() then
return true
end
if player:isVip() then
local pos = player:getPosition()
Game.sendAnimatedText("{VIP}", pos,TEXTCOLOR_RED)
pos:sendMagicEffect(effect)
end
end
return true
end
or try here..

Lua:
local colors = {5, 30, 35, 95, 108, 129, 143, 155, 180, 198, 210, 215}

local globalevent = GlobalEvent("staffvip")

function globalevent.onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local position = player:getPosition()
       
        if player:isVip() then
            local color = colors[math.random(#colors)]
            Game.sendAnimatedText("VIP", position, color)
        elseif player:getGroup():getAccess() and not player:isInGhostMode() then
            local color = colors[math.random(#colors)]
            Game.sendAnimatedText("STAFF", position, color)
        end
    end
    return true
end

globalevent:interval(10000) -- Will run every 1000ms (1 second)
globalevent:register()

about staff appearing only for GM and not for the player.. and isVip yes for normal players :)
 
or try here..

Lua:
local colors = {5, 30, 35, 95, 108, 129, 143, 155, 180, 198, 210, 215}

local globalevent = GlobalEvent("staffvip")

function globalevent.onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local position = player:getPosition()
     
        if player:isVip() then
            local color = colors[math.random(#colors)]
            Game.sendAnimatedText("VIP", position, color)
        elseif player:getGroup():getAccess() and not player:isInGhostMode() then
            local color = colors[math.random(#colors)]
            Game.sendAnimatedText("STAFF", position, color)
        end
    end
    return true
end

globalevent:interval(10000) -- Will run every 1000ms (1 second)
globalevent:register()

about staff appearing only for GM and not for the player.. and isVip yes for normal players :)
Thank you, I used it and I receive this message,
The staff's idea was really cool :D

Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
LuaScriptInterface::luaCreateGlobalEvent(). GlobalEvents can only be registered in the Scripts interface.
stack traceback:
[C]: in function 'GlobalEvent'
data/globalevents/scripts/vipEffect.lua:3: in main chunk

Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
data/globalevents/scripts/vipEffect.lua:5: attempt to index local 'globalevent' (a nil value)
stack traceback:
[C]: in function '__newindex'
data/globalevents/scripts/vipEffect.lua:5: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/vipEffect.lua
 
Last edited:
Thank you, I used it and I receive this message,
The staff's idea was really cool :D

Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
LuaScriptInterface::luaCreateGlobalEvent(). GlobalEvents can only be registered in the Scripts interface.
stack traceback:
[C]: in function 'GlobalEvent'
data/globalevents/scripts/vipEffect.lua:3: in main chunk

Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
data/globalevents/scripts/vipEffect.lua:5: attempt to index local 'globalevent' (a nil value)
stack traceback:
[C]: in function '__newindex'
data/globalevents/scripts/vipEffect.lua:5: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/vipEffect.lua
revscript '-'
 
revscript '-'
Ohh bro, my mistake, thanks, it's working
Uefa Champions League Sport GIF by UEFA
 
Back
Top