Hello, I was making this script and I have been testing it, and I get some errors:
1.-When using the command it always says: This skill cannot go any higher! when trying to add points to a diferent skill.
Ex: I have one-handed 150, but I'am adding shielding which is on 10, the scripts sends the cancel
2.- The Skill/Mag capacity doesn't work.
Ex: I have one-handed 150, if I use the talk action again it will add another one, but this time will send the cancel.
This is my script:
- - - Updated - - -
BUMP!
1.-When using the command it always says: This skill cannot go any higher! when trying to add points to a diferent skill.
Ex: I have one-handed 150, but I'am adding shielding which is on 10, the scripts sends the cancel
2.- The Skill/Mag capacity doesn't work.
Ex: I have one-handed 150, if I use the talk action again it will add another one, but this time will send the cancel.
This is my script:
Code:
local config = {
maxmaglevel = 150,
maxskilllevel = 150
}
function onSay(cid, words, param)
if (getPlayerStorageValue(cid, 14574) < 0) then
doPlayerSetStorageValue(cid, 14574, 0)
end
if (param == "check") then
doPlayerPopupFYI(cid, "Skill Points\n\nAvailable points: ".. getPlayerStorageValue(cid, 14574) .."\nPoints per level: 3")
end
if (param == "health") then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 10)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doCreatureAddHealth(cid, 10)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "mana") then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 10)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doCreatureAddMana(cid, 10)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "magic") then
doPlayerAddMagLevel(cid, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerMagLevel(cid) >= config.maxmaglevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "two-handed") then
doPlayerAddSkill(cid, 1, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 1) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "one-handed") then
doPlayerAddSkill(cid, 2, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 2) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "dual") then
doPlayerAddSkill(cid, 3, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 3) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "distance") then
doPlayerAddSkill(cid, 4, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 4) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "shielding") then
doPlayerAddSkill(cid, 5, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
return doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 5) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
if (param == "sneaking") then
doPlayerAddSkill(cid, 6, 1)
doPlayerSetStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - 1)
return doSendMagicEffect(getThingPos(cid), 30)
elseif (getPlayerSkillLevel(cid, 6) >= config.maxskilllevel) then
doPlayerSendCancel(cid, "This skill cannot go any higher!")
doSendMagicEffect(getThingPos(cid), 2)
elseif (getPlayerStorageValue(cid, 14574) < 1) then
doPlayerSendCancel(cid, "You do not have enough points.")
doSendMagicEffect(getThingPos(cid), 2)
end
return true
end
- - - Updated - - -
BUMP!
Last edited: