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

Solved Square Trainer

Cykotitan, that would only do some good to the players shielding. What you could do though, is to use this function.
PHP:
doPlayerAddSkillTry(cid, skillid, n)
 
This hasn't been tested, but something like this should do and if it doesn't, you might have to modify it a bit as I did this in a rush. Good luck.
PHP:
function onStepIn(cid, item, pos)
    if isPlayer(cid) then
        addEvent(trainSkills, 6000, {cid = cid})
    end
    return TRUE
end

function onStepOut(cid, item, pos)
    stopEvent(trainSkills)
    return TRUE
end

function trainSkills(parameters)
    local cid = parameters.cid
    -- Define skills.
    local fist = getPlayerSkillLevel(cid, 0)
    local club = getPlayerSkillLevel(cid, 1)
    local sword = getPlayerSkillLevel(cid, 2)
    local axe = getPlayerSkillLevel(cid, 3)
    local dist = getPlayerSkillLevel(cid, 4)
    if fist > club and fist > sword and fist > axe and fist > dist then
        doPlayerAddSkillTry(cid, 0) -- Train fist.
        doPlayerAddSkillTry(cid, 5) -- Train shielding.
    elseif club > fist and club > sword and club > axe and club > dist then
        doPlayerAddSkillTry(cid, 1) -- Train club.
        doPlayerAddSkillTry(cid, 5) -- Train shielding.
    elseif sword > fist and sword > club and sword > axe and sword > dist then
        doPlayerAddSkillTry(cid, 2) -- Train sword.
        doPlayerAddSkillTry(cid, 5) -- Train shielding.
    elseif axe > fist and axe > club and axe > sword and axe > dist then
        doPlayerAddSkillTry(cid, 3) -- Train axe.
        doPlayerAddSkillTry(cid, 5) -- Train shielding.
    elseif dist > fist and dist > club and dist > sword and dist > axe then
        doPlayerAddSkillTry(cid, 4) -- Train distance.
        doPlayerAddSkillTry(cid, 5) -- Train shielding.
    else
        doPlayerSendCancel(cid, "Atleast one of your skills has to be higher then the others.")
    end
    addEvent(trainSkills, 6000, {cid = cid})
end
 
Anytime, did it work?

nope got a script error, also it loops even when i step off the tile

Code:
[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaGetPlayerSkillLevel(). Player not found

[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaGetPlayerSkillLevel(). Player not found

[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaGetPlayerSkillLevel(). Player not found

[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaGetPlayerSkillLevel(). Player not found

[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaGetPlayerSkillLevel(). Player not found

[05/01/2009 12:31:52] Lua Script Error: [MoveEvents Interface] 
[05/01/2009 12:31:52] in a timer event called from: 
[05/01/2009 12:31:52] data/movements/scripts/t1.lua:onStepIn

[05/01/2009 12:31:52] luaDoPlayerSendCancel(). Player not found
 
Last edited:
Back
Top