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

Can someone help me add if statements to this script pls

Cris2387

Member
Joined
Dec 30, 2013
Messages
177
Reaction score
9
this is how i want this script to work, the player buys a skill scroll and depending on the player current skill the script will set his skill to some other skill understand lol? example if player has 150 axe skill and says the command, then set skill axe to 200, another one, if axe skill is 200 or higher, then set skill to 250, if player axe skill is 250 or higher then set skill to 300 if axe skill is 300 or higher set skill level to 350 if skill level 350 or higher set axe skill to 400, and it will stop at 400 hehe :) this is the script i have right now
PHP:
function onSay(cid, words, param)
if (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"You need to be in a protection zone to use this command.")
return TRUE
end

if doPlayerRemoveItem(cid,5952,1) and getPlayerVocation(cid) == 8 then
doPlayerSetSkill(cid, 3, 400)
else
doPlayerSendCancel(cid, 'You need to be promoted to Elite Knight, and have a skill scroll to use this command.')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FLAMEAREA)
end
end
this script right now will set the player axe skill to 400 regardless of the skill he has :) i have like 6 other scripts that add different skills to the players but i only need this one just to see an example i can edit the other ones. thank you i really need this script!
 
You have an extra end.
I'll post this. but I don't have time to help atm. :p
Code:
local skill, amount = SKILL_SWORD, 3
for i = 1, amount do
doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
end
The above will add 3 swording levels.
 
You have an extra end.
I'll post this. but I don't have time to help atm. :p
Code:
local skill, amount = SKILL_SWORD, 3
for i = 1, amount do
doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
end
The above will add 3 swording levels.
okay ill be patient :)

bummmp =) i really need this script
 
Last edited by a moderator:
Hey :)

This can be accomplished using the modulus function, %. Here's a function that returns a number to the nearest multiple of 50, and has an upper bound of 400.

Code:
function getNewSkill(currentSkill, upperBound)

    local newSkill = currentSkill + 50 - currentSkill % 50
    return (upperBound > newSkill) and newSkill or upperBound

end
 
Hey :)

This can be accomplished using the modulus function, %. Here's a function that returns a number to the nearest multiple of 50, and has an upper bound of 400.

Code:
function getNewSkill(currentSkill, upperBound)

    local newSkill = currentSkill + 50 - currentSkill % 50
    return (upperBound > newSkill) and newSkill or upperBound

end
okay im going to test this immediately

okay im going to test this immediately
how do i edit the skill? i want axe
 
Last edited by a moderator:
Back
Top