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

Lua VIP Effect Help tfs 1.2

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,181
Solutions
2
Reaction score
117
Hello, how to convert to tfs 1.2 please? Or have other method to use for Effet VIP on players who have VIP (storage)?



Code:
local delay = 999          --Intervalo de tempo entre o efeito, em milésimos de segundo.
function sendVipEffect(cid)
    if isPlayer(cid) and isPremium(cid) then
        doSendAnimatedText(getThingPos(cid), "[VIP]", math.random(1, 255))
        addEvent(sendVipEffect, delay, cid)
    end
end
function onLogin(cid)
    sendVipEffect(cid)
    return true
end

thankss
 
Code:
local delay = 999          --Intervalo de tempo entre o efeito, em milésimos de segundo.
function sendVipEffect(player)
    if isPlayer(player) and isPremium(player) then
        player:say("[VIP]", TALKTYPE_MONSTER_SAY)
        addEvent(sendVipEffect, delay, player)
    end
end
function onLogin(player)
    sendVipEffect(player)
    return true
end
doSendAnimatedText doesnt exist in 1.2 anymore, can only use animated numbers, or orange monster text
 
hello
I tried to make a script for this, but I got lost and I miss a function, will someone help?
I don't have error in console
Animation works, text does not (selfposition?)
Lua:
local config = {
    positions = {
        ["VIP"] = selfposition
    },

    colors = {
    TALKTYPE_MONSTER_SAY,
    TALKTYPE_MONSTER_YELL
    }
}
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
                if getPlayerStorageValue(cid,27897)               >= 1 then
                doSendMagicEffect(getPlayerPosition(cid), 17)
                for name, text, pos in pairs(config.positions) do
        doSendAnimatedText(name, pos, text, config.colors[math.random(1, #config.colors)])
      
             end
            end
         end
         return true
end
 
hello
I tried to make a script for this, but I got lost and I miss a function, will someone help?
I don't have error in console
Animation works, text does not (selfposition?)
Lua:
local config = {
    positions = {
        ["VIP"] = selfposition
    },

    colors = {
    TALKTYPE_MONSTER_SAY,
    TALKTYPE_MONSTER_YELL
    }
}
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
                if getPlayerStorageValue(cid,27897)               >= 1 then
                doSendMagicEffect(getPlayerPosition(cid), 17)
                for name, text, pos in pairs(config.positions) do
        doSendAnimatedText(name, pos, text, config.colors[math.random(1, #config.colors)])
     
             end
            end
         end
         return true
end
You can adapt this code to use vip :p

Lua:
local config = {
    interval = 10 * 1000, -- 10 seconds
    text = "[Top Level]",
    effect = 14
}

local event = GlobalEvent("TopLevelEffect")

function event.onThink(interval)
    local resultId = db.storeQuery("SELECT name FROM players WHERE group_id < 2 ORDER BY level DESC LIMIT 1;")
    if not resultId then
        return true
    end

    local player = Player(result.getString(resultId, "name"))
    if player then
        local position = player:getPosition()
        position:sendMagicEffect(config.effect)
        player:say(config.text, TALKTYPE_MONSTER_SAY, false, nil, position)
    end

    result.free(resultId)
    return true
end

event:interval(config.interval)
event:register()
 
You can adapt this code to use vip :p

Lua:
local config = {
    interval = 10 * 1000, -- 10 seconds
    text = "[Top Level]",
    effect = 14
}

local event = GlobalEvent("TopLevelEffect")

function event.onThink(interval)
    local resultId = db.storeQuery("SELECT name FROM players WHERE group_id < 2 ORDER BY level DESC LIMIT 1;")
    if not resultId then
        return true
    end

    local player = Player(result.getString(resultId, "name"))
    if player then
        local position = player:getPosition()
        position:sendMagicEffect(config.effect)
        player:say(config.text, TALKTYPE_MONSTER_SAY, false, nil, position)
    end

    result.free(resultId)
    return true
end

event:interval(config.interval)
event:register()
Lua Script Error: [Test Interface]
data/globalevents/scripts/vipEffect.lua
data/globalevents/scripts/vipEffect.lua:7: attempt to call global 'GlobalEvent' (a nil value)
stack traceback:
[C]: in function 'GlobalEvent'
data/globalevents/scripts/vipEffect.lua:7: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/vipEffect.lua

i changed toplvleffect to vipeffect

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

i changed toplvleffect to vipeffect

<globalevent name="vipEffect" interval="5000" script="vipEffect.lua"/>
You're getting this error, because it's for tfs 1.3+, but you're using some earlier version, probably 0.4?
Your script you posted initially looked good, just had position wrong.

If you want a specific position, change
selfposition to {x = 1000, y = 1000, z = 7}

If you want it to show up at the player position
change
Lua:
doSendAnimatedText(name, pos, text, config.colors[math.random(1, #config.colors)])
to
Lua:
doSendAnimatedText(name, getPlayerPosition(cid), text, config.colors[math.random(1, #config.colors)])
 
You're getting this error, because it's for tfs 1.3+, but you're using some earlier version, probably 0.4?
Your script you posted initially looked good, just had position wrong.

If you want a specific position, change
selfposition to {x = 1000, y = 1000, z = 7}

If you want it to show up at the player position
change
Lua:
doSendAnimatedText(name, pos, text, config.colors[math.random(1, #config.colors)])
to
Lua:
doSendAnimatedText(name, getPlayerPosition(cid), text, config.colors[math.random(1, #config.colors)])
1.3 otbr 10.99
don't work -> error debugprint
 

Similar threads

Back
Top