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

Add MagicEffect

haji h ali

Member
Joined
Sep 10, 2013
Messages
59
Reaction score
6
Hello,
can someone add MagicEffect into this script, please. TFS 0.3.6

- ADD THIS
doSendMagicEffect(getPlayerPosition(cid), 27)
doSendAnimatedText(getPlayerPosition(cid), "VIP", TEXTCOLOR_RED)


- INTO THIS

local config = {
txt = 'VIP',
txtColor = TEXTCOLOR_RED,
set = { -- Equipamento que componga el Set.
-- [Slot que ocupa en el Set] = ID del equipamento,
[CONST_SLOT_HEAD] = 7903, -- Helmet
[CONST_SLOT_ARMOR] = 7884, -- Armor
[CONST_SLOT_LEGS] = 7885, -- Legs
[CONST_SLOT_RIGHT] = 8903, -- RIGHT
[CONST_SLOT_FEET] = 9932, -- Boots
},
weapons = {2453,}, -- Posibles weapons que llevará en las manos.
}
local function isUsingSet(pid, set)
if not isPlayerGhost(pid) then
for slot, item_id in pairs(set) do
if getPlayerSlotItem(pid, slot).itemid ~= item_id then
return false
end
end
end
return true
end
function onThink(interval)
for _, name in ipairs(getOnlinePlayers()) do
local pid = getPlayerByName(name)
local pos = getPlayerPosition(pid)
if isUsingSet(pid, config.set) then
if isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_LEFT).itemid) or isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_RIGHT).itemid) then
doSendAnimatedText(pos, config.txt, config.txtColor)
end
end
end
return true
end
 
Last edited:
Solution
It didn't worked!
[30/05/2018 13:18:47] [Error - GlobalEvent Interface]
[30/05/2018 13:18:47] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:47] Description:
[30/05/2018 13:18:47] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found

:p, just change the onThink function to this

Lua:
function...
Hello,
can someone add MagicEffect into this script, please.

- ADD THIS
doSendMagicEffect(getPlayerPosition(cid), 27)
doSendAnimatedText(getPlayerPosition(cid), "VIP", TEXTCOLOR_RED)


- INTO THIS

local config = {
txt = 'VIP',
txtColor = TEXTCOLOR_RED,
set = { -- Equipamento que componga el Set.
-- [Slot que ocupa en el Set] = ID del equipamento,
[CONST_SLOT_HEAD] = 7903, -- Helmet
[CONST_SLOT_ARMOR] = 7884, -- Armor
[CONST_SLOT_LEGS] = 7885, -- Legs
[CONST_SLOT_RIGHT] = 8903, -- RIGHT
[CONST_SLOT_FEET] = 9932, -- Boots
},
weapons = {2453,}, -- Posibles weapons que llevará en las manos.
}
local function isUsingSet(pid, set)
if not isPlayerGhost(pid) then
for slot, item_id in pairs(set) do
if getPlayerSlotItem(pid, slot).itemid ~= item_id then
return false
end
end
end
return true
end
function onThink(interval)
for _, name in ipairs(getOnlinePlayers()) do
local pid = getPlayerByName(name)
local pos = getPlayerPosition(pid)
if isUsingSet(pid, config.set) then
if isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_LEFT).itemid) or isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_RIGHT).itemid) then
doSendAnimatedText(pos, config.txt, config.txtColor)
end
end
end
return true
end

Lua:
local config = {
set = { -- Equipamento que componga el Set.
-- [Slot que ocupa en el Set] = ID del equipamento,
[CONST_SLOT_HEAD] = 7903, -- Helmet
[CONST_SLOT_ARMOR] = 7884, -- Armor
[CONST_SLOT_LEGS] = 7885, -- Legs
[CONST_SLOT_RIGHT] = 8903, -- RIGHT
[CONST_SLOT_FEET] = 9932, -- Boots
},
weapons = {2453,}, -- Posibles weapons que llevará en las manos.
}

local function isUsingSet(pid, set)
    if not isPlayerGhost(pid) then
        for slot, item_id in pairs(set) do
            if getPlayerSlotItem(pid, slot).itemid ~= item_id then
                return false
            end
        end
    end
   
    return true
end

function onThink(cid, interval)
    for _, name in ipairs(getOnlinePlayers()) do
        local pid = getPlayerByName(name)
        local pos = getPlayerPosition(pid)
        if isUsingSet(pid, config.set) then
            if isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_LEFT).itemid) or isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_RIGHT).itemid) then
                doSendMagicEffect(getPlayerPosition(cid), 27)
                doSendAnimatedText(getPlayerPosition(cid), "VIP", TEXTCOLOR_RED)
            end
        end
    end
   
    return true
end

not tested and not sure if it's for TFS 1.0 :p
 
It didn't worked!
[30/05/2018 13:18:47] [Error - GlobalEvent Interface]
[30/05/2018 13:18:47] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:47] Description:
[30/05/2018 13:18:47] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found
 
It didn't worked!
[30/05/2018 13:18:47] [Error - GlobalEvent Interface]
[30/05/2018 13:18:47] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:47] Description:
[30/05/2018 13:18:47] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found
[30/05/2018 13:18:50] [Error - GlobalEvent Interface]
[30/05/2018 13:18:50] data/globalevents/scripts/Frozen.lua:eek:nThink
[30/05/2018 13:18:50] Description:
[30/05/2018 13:18:50] (luaGetThingPosition) Thing not found

:p, just change the onThink function to this

Lua:
function onThink(interval)
    for _, name in ipairs(getOnlinePlayers()) do
        local pid = getPlayerByName(name)
        local pos = getPlayerPosition(pid)

        if isUsingSet(pid, config.set) then
            if isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_LEFT).itemid) or isInArray(config.weapons, getPlayerSlotItem(pid, CONST_SLOT_RIGHT).itemid) then
                doSendMagicEffect(getPlayerPosition(pid), 27)
                doSendAnimatedText(getPlayerPosition(pid), "VIP", TEXTCOLOR_RED)
            end
        end
    end
 
    return true
end
 
Solution
Back
Top