Hello,
Ive searched around the forum found similar scripts, but i didn't like them much so i made a new one.
I made this because traning how to make tables, Thanks to Limos for his link!
First go to creaturescripts/creaturescripts.xml and copy the line below:
Then go to creaturescripts/scripts/login.lua and paste the line below:
Now at creaturescripts/scripts and create new lua and name it {levelup.lua} and paste the code below:
Ive searched around the forum found similar scripts, but i didn't like them much so i made a new one.
I made this because traning how to make tables, Thanks to Limos for his link!
First go to creaturescripts/creaturescripts.xml and copy the line below:
Lua:
<event type="advance" name="LevelUp" event="script" value="levelup.lua"/>
Then go to creaturescripts/scripts/login.lua and paste the line below:
Lua:
registerCreatureEvent(cid, "LevelUp")
Now at creaturescripts/scripts and create new lua and name it {levelup.lua} and paste the code below:
Lua:
--//Credits: Printer//--
local config = {
savePlayer = true, --Save Player When The Gain Level!
healPlayerOnLevel = true, --Heal Players Hp And Mana On Level!
effectOnLevel = true, --Fireworks Effect On Level!
getServerVersionUnder860 = true, --If the server is 860 and lower than that, leave it true! If its over 860, use false!
levelText = "LEVEL UP!", --Gain Level Text!
Sorcerer = {
Vocsid = {1,5}, --Vocs id for Wizards
[20] = {item = 2160, count = 100, storage = 3000}, --///[Level] = {item = ItemId, count = ItemCount}///--
[40] = {item = 2152, count = 100, storage = 3001} --///[Level] = {item = ItemId, count = ItemCount}///--
},
Druid = {
Vocsid = {2,6}, --Vocs id for Mages
[20] = {item = 2160, count = 100, storage = 3002}, --///[Level] = {item = ItemId, count = ItemCount}///--
[40] = {item = 2152, count = 100, storage = 3003} --///[Level] = {item = ItemId, count = ItemCount}///--
},
Paladin = {
Vocsid = {3,7}, --Vocs id for Rangers
[20] = {item = 2160, count = 100, storage = 3004}, --///[Level] = {item = ItemId, count = ItemCount}///--
[40] = {item = 2152, count = 100, storage = 3005} --///[Level] = {item = ItemId, count = ItemCount}///--
},
Knight = {
Vocsid = {4,8}, --Vocs id for Warriors
[20] = {item = 2160, count = 100, storage = 3006}, --///[Level] = {item = ItemId, count = ItemCount}///--
[40] = {item = 2152, count = 100, storage = 3007} --///[Level] = {item = ItemId, count = ItemCount}///--
},
}
function onAdvance(cid, skill, oldLevel, newLevel)
if(skill == SKILL__EXPERIENCE) then
return true
end
if(newLevel < oldLevel)then return true end
if(skill == SKILL__LEVEL and config.healPlayerOnLevel) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doSendMagicEffect(getCreaturePosition(cid), math.random(28, 30))
if config.getServerVersionUnder860 then
doSendAnimatedText(getCreaturePosition(cid), config.levelText, math.random(1,255))
else
doCreatureSay(cid,config.levelText,TALKTYPE_ORANGE_1)
end
end
if(config.savePlayer) then
doPlayerSave(cid, true)
end
local sorc,druid,pally,knight = config.Sorcerer[getPlayerLevel(cid)],config.Druid[getPlayerLevel(cid)],config.Paladin[getPlayerLevel(cid)],config.Knight[getPlayerLevel(cid)]
if (isInArray(config.Sorcerer.Vocsid, getPlayerVocation(cid)) or isInArray(config.Druid.Vocsid, getPlayerVocation(cid)) or isInArray(config.Paladin.Vocsid, getPlayerVocation(cid)) or isInArray(config.Knight.Vocsid, getPlayerVocation(cid))) then
if (sorc and isInArray(config.Sorcerer.Vocsid, getPlayerVocation(cid)) and (getPlayerStorageValue(cid,config.Sorcerer.storage) == -1)) then
doPlayerAddItem(cid,sorc.item,sorc.count)
setPlayerStorageValue(cid, config.sorc.storage,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have recived "..sorc.count.."x "..getItemNameById(sorc.item).."." )
elseif (druid and isInArray(config.Druid.Vocsid, getPlayerVocation(cid)) and (getPlayerStorageValue(cid,config.Druid.storage) == -1)) then
doPlayerAddItem(cid,druid.item,druid.count)
setPlayerStorageValue(cid, config.druid.storage,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have recived "..druid.count.."x "..getItemNameById(druid.item).."." )
elseif (pally and isInArray(config.Paladin.Vocsid, getPlayerVocation(cid)) and (getPlayerStorageValue(cid,config.Paladin.storage) == -1)) then
doPlayerAddItem(cid,pally.item,pally.count)
setPlayerStorageValue(cid, config.pally.storage,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have recived "..pally.count.."x "..getItemNameById(pally.item).."." )
elseif (knight and isInArray(config.Knight.Vocsid, getPlayerVocation(cid)) and (getPlayerStorageValue(cid,config.Knight.storage) == -1)) then
doPlayerAddItem(cid,knight.item,knight.count)
setPlayerStorageValue(cid, config.knight.storage,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have recived "..knight.count.."x "..getItemNameById(knight.item).."." )
end
else
print("Your vocation id doesn't exsist: "..getPlayerVocation(cid)..".")
end
return true
end
Last edited: