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

Lua Awesome teleport script

AngeloFuturo

Scan QR for free money.
Joined
Mar 29, 2008
Messages
77
Reaction score
6
Location
Who's asking?
I recently added the Temple Teleport Script to my server.

However, I would like to add something. Note that I know NOTHING about LUA. I just need pure help from an experienced scripter.

Here is my script:
local scroll = 6119
local temple = {x=160, y=50, z=7}
local level = 8

function onUse(cid, item, frompos, item2, topos)
if item.itemid == scroll and getPlayerLevel(cid) >= level then
doTeleportThing(cid, temple, TRUE)
doSendMagicEffect(temple,10)
doSendAnimatedText(temple, "TELEPORT", 5)
doRemoveItem(cid, item.uid, 1)
else
doPlayerSendCancel(cid, "Sorry, your level must higher than 8!")
end
return 1
end

I would like to add this:

* The script can't be used IN BATTLE. Any kind of battle. Even just hunting battle.

... That's it. Can somebody be nice and just add the code to the script and post it here?

That would be awfully kind of you!

Thanks in advance guys
 
No no no.... I mean any kind of battle. Regular hunting for example. Protection tool only works when you have white skull/PVP-battlemark.

I mean all battles.

Somebody post me a little script please? :/
 
Code:
local cfg = {
	level = 8,
	useWithPz = "no", -- "yes" or "no"
	removeOnUse = "yes", -- "yes" or "no"
	pos = {x = 160, y = 50, z = 7}
}

cfg.removeOnUse = getBooleanFromString(cfg.useWithPz)
cfg.useWithPz = getBooleanFromString(cfg.removeOnUse)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) < cfg.level then
		[B][COLOR="Red"]return[/COLOR][/B] doCreatureSay(cid, "Sorry, your level is too low.", TALKTYPE_ORANGE_1, false, cid)
	end
	
	if not cfg.useWithPz and hasCondition(cid, CONDITION_INFIGHT) == true then
		[B][COLOR="Red"]return[/COLOR][/B] doCreatureSay(cid, "Sorry, you cannot use this in battle.", TALKTYPE_ORANGE_1, false, cid)
	end
	
	doTeleportThing(cid, cfg.pos)
	if cfg.removeOnUse then
		doRemoveItem(item.uid)
		return true
	end
	
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
end
_?!_!?_
 
I tried the script.

Problem:

* "Sorry, you can't use this in battle" - But it STILL TELEPORTS.
* "Sorry, your level is too low" - But it STILL TELEPORTS.
* The scroll is not removed after I use it. Infinite charges :/

Thanks guys, I appreciate the help so far! :*
 
JDB, you managed to fix ONE thing: The scroll actually removes after use. That's good.

However, the two previous problems are still there...

* "Sorry, you can't use this in battle" - But it STILL TELEPORTS.
* "Sorry, your level is too low" - But it STILL TELEPORTS.

Wow, I didn't realize scripting could be so complicated :/ Thanks anyways, JDB!
 
you must return if your gonna make it this way....... or it will remove and teleport him everytime hes using it maybe im wrong but test it.
 
Back
Top