• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Get item on Certain Level

patriciou

Member
Joined
Dec 26, 2009
Messages
180
Reaction score
6
Hello Otlanders, I need a Script that :

Gives an Item to a Player when he Reaches certain Level

And a Script that When a Person enteres a Teleport then Message Comes up Saying " Welcome to (City name) "

REP++ For Help :)
 
You need to edit these parts for your own desire.

local level = 20 <-- level where player gets item
doPlayerAddItem(cid, 2160, 2) -- ID of item he gets, and count (how many he gets)
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
local level = 20
local playername = getCreatureName(cid)
	if getPlayerLevel(cid) == level and getPlayerStorageValue(cid, 44923) == -1 then
	setPlayerStorageValue(cid, 44923, 1)
	doPlayerAddItem(cid, 2160, 2)
end
	return true
end
(this is a creaturescript you need to register it login.lua and add to creaturescripts.xml)

And for second script
local pos = {x=154, y=107, z=6} <-- coordinates where teleport takes you
doCreatureSay(cid, "Welcome to (city name)!", TALKTYPE_ORANGE_1) -- replace (city name) with name of the city you want.
LUA:
function onStepIn(cid, item, position, fromPosition) 
local pos = {x=154, y=107, z=6}
doTeleportThing(cid, pos)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doCreatureSay(cid, "Welcome to (city name)!", TALKTYPE_ORANGE_1)
return TRUE 
end
(register this as movement, add unique id to sqm where your teleport is and don't add any destonation to your teleporter)
 
Did you add it as advance?
LUA:
	<event type="advance" name="lelvelitem" event="script" value="levelitem.lua"/>

And did you register it to login.lua
LUA:
	registerCreatureEvent(cid, "levelitem")
 
you should use >= in case he advances to 21 or such
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
	if newlevel >= 20 and getCreatureStorage(cid, 44923) == -1 then
		doCreatureSetStorage(cid, 44923, 1)
		doPlayerAddItem(cid, 2160, 2)
	end
	return true
end
 
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
	if newlevel >= 20 and getCreatureStorage(cid, 44923) == -1 then
		doCreatureSetStorage(cid, 44923, 1)
		doPlayerAddItem(cid, 2160, 2)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You've just recieved 2 ".. getItemNameById(2160) .."s for reaching level 20!")
	end
	return true
end
 
You sure are demanding....
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
	if newlevel >= 20 and getCreatureStorage(cid, 44923) == -1 then
		doCreatureSetStorage(cid, 44923, 1)
		doPlayerAddItem(cid, 2160, 2)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have recieved xxxx.")

	end
	return true
end
 
Back
Top