• 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+ Debug effect talkaction

Lucck

New Member
Joined
Nov 1, 2018
Messages
10
Reaction score
1
Code:
function onSay(cid, words, param)
 
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end
 
    local params = param:split(" ")
    if params[3] == nil then
        player:sendCancelMessage("Insufficient parameters.")
        return false
    end
 
    local ef    = tonumber(params[1]) or 22
    local times = tonumber(params[2]) or 0
    local delay = tonumber(params[3]) or 2000
 
    debug_ef_repeat(player:getPosition(), ef, delay, 0, times)
    return true
end

function debug_ef_repeat (pos, ef, delay, times, stopat)

    times = times or 0
    doSendMagicEffect(pos, ef)
    if times <= stopat then
        addEvent(debug_ef_repeat, delay, pos, ef + times, delay, times + 1, stopat)
    end
end

Tfs 1.3, need help adding 4º & 5º parameter to this talkaction.

Actually it is /ef 45 20 1000
45 = effect id
20 = how many times the id will loop on screen
1000 = time between each loop

I need add more two parameters, parameters of position x and y.

/ef 45 20 1000 8 9

8 = playerposition.x+8
9 = playerpostion.y +9


Then parameter 4 add playerposition.x and param 5 is playerposition.y to effect position;



2018-11-30_11-40-56.gif
 
Last edited:
Solution
Lua:
function onSay(cid, words, param)

    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local params = param:split(" ")
    if params[3] == nil then
        player:sendCancelMessage("Insufficient parameters.")
        return false
    end

    local ef    = tonumber(params[1]) or 22
    local times = tonumber(params[2]) or 0
    local delay = tonumber(params[3]) or 2000
    local add_x = tonumber(params[4]) or 0
    local add_y = tonumber(params[5]) or 0
    local player_pos = player:getPosition()
    player_pos.x = player_pos.x + add_x
    player_pos.y = player_pos.y + add_y...
Lua:
function onSay(cid, words, param)

    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local params = param:split(" ")
    if params[3] == nil then
        player:sendCancelMessage("Insufficient parameters.")
        return false
    end

    local ef    = tonumber(params[1]) or 22
    local times = tonumber(params[2]) or 0
    local delay = tonumber(params[3]) or 2000
    local add_x = tonumber(params[4]) or 0
    local add_y = tonumber(params[5]) or 0
    local player_pos = player:getPosition()
    player_pos.x = player_pos.x + add_x
    player_pos.y = player_pos.y + add_y
    debug_ef_repeat(player_pos, ef, delay, 0, times)
    return true
end

function debug_ef_repeat (pos, ef, delay, times, stopat)

    times = times or 0
    doSendMagicEffect(pos, ef)
    if times <= stopat then
        addEvent(debug_ef_repeat, delay, pos, ef + times, delay, times + 1, stopat)
    end
end
 
Solution
@Bogart how can i add two effects ? /ef {id effect 1} {id effect 2} {how many times effect will run} {time between each run}
Lua:
function onSay(cid, words, param)

    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local params = param:split(" ")
    if params[3] == nil then
        player:sendCancelMessage("Insufficient parameters.")
        return false
    end

    local ef    = tonumber(params[1]) or 22
    local ef2   = tonumber(params[2]) or 22
    local times = tonumber(params[3]) or 0
    local delay = tonumber(params[4]) or 2000
    local add_x = tonumber(params[5]) or 0
    local add_y = tonumber(params[6]) or 0
    local player_pos = player:getPosition()
    player_pos.x = player_pos.x + add_x
    player_pos.y = player_pos.y + add_y
    debug_ef_repeat(player_pos, ef, delay, 0, times)   
    debug_ef_repeat(player_pos, ef2, delay, 0, times)
    return true
end

function debug_ef_repeat (pos, ef, delay, times, stopat)

    times = times or 0
    doSendMagicEffect(pos, ef)
    if times <= stopat then
        addEvent(debug_ef_repeat, delay, pos, ef + times, delay, times + 1, stopat)
    end
end
 
Back
Top