• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action A Small OnAdvance System

perfection

FATAL DAMAGE
Joined
Aug 27, 2011
Messages
196
Reaction score
8
Ok this script is an onAdvance System which is When a player reaches lvl 200 he will get a temple teleport scroll and on lvl 400 will get a Red Skull Remover i know its simple but it might be usefull to someone :)

first in data/creaturescripts/scripts/items.lua

Lua:
local levelx = 200 -- Level Needed for first item
local levelxx = 400 -- Level Needed for second item
local itemx = 6087 -- First Reward Id
local itemxx = 9969 -- Second Reward Id
function onAdvance(cid, skill, oldLevel, newLevel)
	if getPlayerLevel(cid) >= levelx and (getPlayerStorageValue(cid, 1002)) ~= 1 then
		doPlayerAddItem(cid, itemx, 1)
		doPlayerSendTextMessage(cid, 23,"You Have Recieved a "..getItemNameById(itemx).." For Reaching Level "..levelx.." .")
		setPlayerStorageValue(cid, 1002, 1)
	end	
		if getPlayerLevel(cid) >= levelxx and (getPlayerStorageValue(cid, 1002)) ~= 2 then
			doPlayerAddItem(cid, itemxx, 1)
			doPlayerSendTextMessage(cid, 23,"You Have Recieved a "..getItemNameById(itemxx).." For Reaching Level "..levelxx.." .")
			setPlayerStorageValue(cid, 1002, 2)
		end

return 1
end

in creaturescripts.xml

Lua:
<event type="advance" name="Reward" event="script" value="items.lua"/>

now for the items : in data/actions/scripts/rewards.lua

Lua:
local itemId = 6087
local itemId2 = 9969
function onUse(cid, item, frompos, item2, topos)
	if item.itemid == itemId and (getPlayerLevel(cid)) >= 200 and isPlayerPzLocked(cid) == FALSE then
		doTeleportThing(cid, getPlayerMasterPos(cid))
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 20,"You Have Been Teleported To Temple.")
	else
		doPlayerSendCancel(cid,"You Are Currently in a fight")
	end	
return 1	
end
function onUse(cid, item, frompos, item2, topos)	
		if item.itemid == itemId2 and (getPlayerLevel(cid)) >= 200 and (getCreatureSkullType(cid)) >= 4 then	
			doCreatureSetSkullType(cid, 0)
			doRemoveItem(cid, item.uid, 1)
			doPlayerSendTextMessage(cid, 20,"You Successfully Got Ur Red/Black Skull Removed .")
		else
			doPlayerSendCancel(cid,"You Dont Have A Red/Black Skull")
		end
return 1
end

and in actions.xml

Lua:
<action itemid="6087;9969" event="script" value="rewards.lua" />

i rly hope u like it :D:D
 
Last edited:
Instead of having;

Lua:
	if getPlayerLevel(cid) >= 200

You can use your locals;

Lua:
 if getPlayerLevel(cid) >= levelx
 
ops lol forgot to change it before posting :D sry about that edited script
 
Back
Top