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

Solved Level Tile for players over 50

Akkz

New Member
Joined
Apr 22, 2012
Messages
172
Reaction score
0
Hello ;) Im trying to learn how to scripting, and what I trying to do is a tile that if you are below level 50 you can enter
Code:
function onStepIn(cid, item, frompos, itemEx, topos)
        if item.uniqueid == 1234 then
		   getPlayerLevel(cid) > 50 then 
		   doPlayerSendTextMessage(cid,21,"It works !")

	elseif getPlayerLevel(cid) < 50 then
	       doPlayerSendCancel(cid,21,"You need to be below level 50.")
		 	 
  return true
		 
end
I get this error in console
Code:
[Error - LuaScriptInterface::loadFile] data/movements/scripts/test.lua:3: unexpe
cted symbol near '>'
[Warning - Event::loadScript] Cannot load script (data/movements/scripts/test.lu
a)
data/movements/scripts/test.lua:3: unexpected symbol near '>'
 
Solution
uid... screw that.

LUA:
function onStepIn(cid, item, frompos, itemEx, topos)
	if getPlayerLevel(cid) < 50 then 
		doPlayerSendTextMessage(cid, "Access granted.")
	else
		doPlayerSendCancel(cid, "You need to be below level 50 to gain access.")
		doTeleportThing(cid, frompos, true)
	end
	return true
end
What do you mean tped? You want them get teleported some place or pushed back 1tile.
 
LUA:
function onStepIn(cid, item, position, fromPosition)
		if isPlayer(cid) and item.uid == 1234 then
			if getPlayerLevel(cid) < 50 then 
				doPlayerSendTextMessage(cid,21,"It works !")
			else
				doPlayerSendCancel(cid,21,"You need to be below level 50.")
				doTeleportThing(cid, fromPosition)
			end
		end
		return true		 
	end
end
Now fixed. onStepIn line was wrong.

changed
Code:
function onStepIn(cid, item, frompos, itemEx, topos)
into
Code:
function onStepIn(cid, item, position, fromPosition)
 
Last edited:
You tried higher lvl than 50? Since as you said higher than 50 shouldnt be able to walk.

- - - Updated - - -

Up its not wrong with the first OnStepIn, its just frompos instead fromPosition xD
 
No, the third parameter in the function was the position he stepped on. So he got teleported to the position, he already stan on. And so it looks like nothing happens, but he only get's teleported wrong.
 
Okey! Now it tells me it works! but I want to, if you are over level 50 you cannot walk on that tile, but now it's possible :/

Ive tested it and it works.

LUA:
local otswe_uid = 1234
 
function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) and item.uid == otswe_uid then
		if getPlayerLevel(cid) >= 50 then 
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid,"You need to be below level 50.")
		else
			doPlayerSendTextMessage(cid,21,"Welcome to the hood.")
		end
	return true		 
	end
end
 
Last edited:
talibaners script, but its like a wall, you can't go into it, its not pushing you back ^^ your script is like his aswell
 
Okey! Now it tells me it works! but I want to, if you are over level 50 you cannot walk on that tile, but now it's possible :/

Then i didnt understand your request -.-

As you wrote later on, if you are over lvl 50 you cant enter, i did that. Now you tell me talibaners worked when his is configured when you are lower than 50.

FFS next time write so atleast so people can understand right.
 
uid... screw that.

LUA:
function onStepIn(cid, item, frompos, itemEx, topos)
	if getPlayerLevel(cid) < 50 then 
		doPlayerSendTextMessage(cid, "Access granted.")
	else
		doPlayerSendCancel(cid, "You need to be below level 50 to gain access.")
		doTeleportThing(cid, frompos, true)
	end
	return true
end
 
Solution
Back
Top