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

CreatureEvent Level 300 > start again + get Level Storage.

Zonet

Web Developer
Joined
Sep 1, 2008
Messages
4,393
Reaction score
52
Location
Tibia VS RL-life, guess whos back?
Hello. I made this script cuz I was bored.

Information:
When you "look" on a player, You'll see like "Zonet got storage 1". Which means he haven't reached lvl 300 yet.
When you reach lvl 300, you'll get storage 2 and start from lvl 8 from beginning. And it works like that, every time you reach lvl 300 your storage will be up (+1).
Also the good thing is that you can make in your highscore.php (website) so it counts by this storage (easily).

Go to data/creaturescript/scripts - create file, name it playerLook
Paste this in playerLook.lua
Lua:
 		--[[
			Script coded by zonet.
			using storage = 9000	
		  ]]--
function onLook(cid, thing, position, lookDistance)
        if(isPlayer(thing.uid) == false) then
            return true
        end
local storage = 9000
        if(getPlayerStorageValue(thing.uid, storage)  < 1) then
		    doPlayerSendTextMessage(cid, 20, ""..getCreatureName(thing.uid).." doesn\'t have any storage.")
            return true
		end
		if(getPlayerStorageValue(thing.uid, storage) >= 1) then
			doPlayerSendTextMessage(cid, 20, ""..getCreatureName(thing.uid).." got a storage "..getPlayerStorageValue(thing.uid, storage)..".")
			return true
		end
        return true
end

Go to data/creaturescript/scripts - create file, name it playerAdvance
Paste this in playerAdvance.lua
Lua:
		--[[
			Script coded by zonet.
			using storage = 9000	
		  ]]--
function onAdvance(cid, skill, oldlevel, newlevel)
local config = {
	level = 300,
	storage = 9000,
	startLevel = 8
}
local tPos = {x =100, y =100, z =7}
	if(skill == SKILL__LEVEL and newlevel >= config.level) then
		setPlayerStorageValue(cid, getPlayerStorageValue(cid, config.storage) + 1)
		doTeleportThing(cid, tPos)
		setPlayerMaxMana(cid, 35)
		setCreatureMaxHealth(cid, 185)		
		doRemoveCreature(cid)
		db.executeQuery("UPDATE ´players´ SET ´level´ = '"..config.startLevel.."', ´experience´ = '"..getExperienceForLevel(config.startLevel).."' WHERE ´name´ = '"..getPlayerName(cid).."';")
		end
	return true
end

Go to Data/creaturescript/creaturescript.xml
Add
Code:
	<event type="look" name="Look" event="script" value="playerLook.lua"/>	
	<event type="advance" name="Advance" event="script" value="playerAdvance.lua"/>

Go to Data/creaturescript/script/login.lua
Under function onlogin(cid)
Add
Lua:
setPlayerStorageValue(cid, 9000, 1)
Under registerCreatureEvent(cid, "PlayerKill")
Add
Lua:
		registerCreatureEvent(cid, "Advance")
		registerCreatureEvent(cid, "Look")

Sorry! Script haven't been tested by anyone yet! Tell me if there is any errors!

:thumbup:
 
Last edited:
mmm
someone already do this, but more advanced and fully worked, i recode it and i have it in my ot with too mjuch features :D
anyways good work :)
 
Nice script!

@up, i think that theotserver use a script like that ;)
 
Nice, but you can use:
Code:
doPlayerSendTextMessage(cid, 20, getCreatureName(thing.uid).." got a storage "..getPlayerStorageValue(thing.uid, storage)..".")

Insteand of:
Code:
doPlayerSendTextMessage(cid, 20, ""..getCreatureName(thing.uid).." got a storage "..getPlayerStorageValue(thing.uid, storage)..".")
 
Nice, but you can use:
Code:
doPlayerSendTextMessage(cid, 20, getCreatureName(thing.uid).." got a storage "..getPlayerStorageValue(thing.uid, storage)..".")

Insteand of:
Code:
doPlayerSendTextMessage(cid, 20, ""..getCreatureName(thing.uid).." got a storage "..getPlayerStorageValue(thing.uid, storage)..".")

Yeah, works too :)

[Edit]
The otserver uses a such script but, it's not same. I thought you guys meant that a such script was "released" cuz I've never seen such script released :). But the otserver uses only 1 time after reach 300. My you get storage everytime you reach :)
 
Go to Data/creaturescript/script/login.lua
Under function onlogin(cid)
Add
Lua Code:
setPlayerStorageValue(cid, 9000, 1)
Lol? So if I have storage 9000 == 4 (4 times I have got 300lvl) then this will give me storage 9000 == 1 :/
Change it to:
Lua:
if getPlayerStorageValue(cid, 9000) <= 0 then
    setPlayerStorageValue(cid, 9000, 0)
return true
end
Or I'm wrong?
 
Lol? So if I have storage 9000 == 4 (4 times I have got 300lvl) then this will give me storage 9000 == 1 :/
Change it to:
Lua:
if getPlayerStorageValue(cid, 9000) <= 0 then
    setPlayerStorageValue(cid, 9000, 0)
return true
end
Or I'm wrong?

No! If your storage (9000) is -1 then it will stay
This player doesn't have any storage.
But if you are a normal like not recahed 300 yet it will stay "This player have storage 1" If you have reached 300 then you get storage +1 which is "2". Also everytime you reach a level 300 your storage will be +1.

As you see on the onLook it checks only if player have >= 1 not == -.-'
 
cool! now I'll be able to make my rep sys for 0.3
q: when you look a player, the message is in green?
 
the messages comes after the player's description?(name/lvl/voc) or is there a way to make the message to come after it?
 
:( yea I know, I asked gelio to do it for me, my 0.2 rep sys doesn't work in 0.3

but:
doPlayerSetSpecialDescription and the name one should work but those functions are bugged -.-
 
nah it's ok 0.2 will be discontinued :)
 
Back
Top