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)
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?
[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