I am very new to scripting on OT tibia servers... date of start, yesterday. I am currenctly working on xp-ganing systems and rebirth systems and I am wondering if onAdvance functions has to have getPlayerStorageValue to work, becuase I have tried a lot of different onAdvance if statement scripts but the only ones that work are those who use getPlayerStorageValue.
Is there another way to write a functional script without getPlayerStorageValue or is it needed?
Reference script; working:
function onAdvance(cid, skill, oldlevel, newlevel)
if(getPlayerStorageValue(cid, 60362) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then
doPlayerAddItem(cid, 2152, 50)
setPlayerStorageValue(cid, 60362, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_RED)
local message = "You have received 15 crystal coins for reaching level 45."
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, 19, "You have received 50 platinum coins for reaching level 45.")
end
return TRUE
end
Reference script; not working:
function onAdvance(cid, skill, oldlevel, newlevel)
if 1 == 1 then
doPlayerAddItem(cid, 2152, 50)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_RED)
local message = "You have received 15 crystal coins for reaching level 45."
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, 19, "You have received 50 platinum coins for reaching level 45.")
end
return TRUE
end
Is there another way to write a functional script without getPlayerStorageValue or is it needed?
Reference script; working:
function onAdvance(cid, skill, oldlevel, newlevel)
if(getPlayerStorageValue(cid, 60362) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then
doPlayerAddItem(cid, 2152, 50)
setPlayerStorageValue(cid, 60362, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_RED)
local message = "You have received 15 crystal coins for reaching level 45."
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, 19, "You have received 50 platinum coins for reaching level 45.")
end
return TRUE
end
Reference script; not working:
function onAdvance(cid, skill, oldlevel, newlevel)
if 1 == 1 then
doPlayerAddItem(cid, 2152, 50)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_RED)
local message = "You have received 15 crystal coins for reaching level 45."
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, 19, "You have received 50 platinum coins for reaching level 45.")
end
return TRUE
end