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

Solved Teleport with storage value

Cloow

Active Member
Joined
May 10, 2010
Messages
1,086
Reaction score
35
Can someone tell me why this script wont work?

When im entering the tile I get teleported even if I dont have the storage value
in console it says - "
[16/01/2013 18:19:00] [Error - MoveEvents Interface]
[16/01/2013 18:19:00] data/movements/scripts/posessedportal.lua:eek:nStepIn
[16/01/2013 18:19:00] Description:
[16/01/2013 18:19:00] (luaDoPlayerSendTextMessage) Player not found"

Lua:
function onStepIn(cid, item, position, fromPosition)
 if getPlayerStorageValue(cid, 37742) then
    doTeleportThing(cid, {x = 2705, y = 2308, z = 7}) 
	doPlayerSendTextMessage(cid, "Welcome to Tews Island!") 
		else
	  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must prove yourself worthy of entering Tews Island.")
		end
		return true
end

neither does this, it says "You already proven you worthy" and in console the same [16/01/2013 18:32:40] [Error - MoveEvents Interface]
[16/01/2013 18:32:40] data/movements/scripts/twst.lua:eek:nStepIn
[16/01/2013 18:32:40] Description:
[16/01/2013 18:32:40] (luaDoPlayerSendTextMessage) Player not found

Lua:
function onStepIn(cid, item, position, fromPosition)
	doPlayerSetStorageValue(cid, 37742, 1)
	doPlayerSendTextMessage(cid, "You have have shown yourself worthy of entering Tews Island!")
    if getPlayerStorageValue(cid, 37742) then
	doPlayerSendCancel(cid, "You already shown yourself worthy")
	return true
end
end
 
Last edited:
Enjoy!
You forgot to give the value of the storage.
Lua:
function onStepIn(cid, item, position, fromPosition)
	if not(isPlayer(cid)) then return true end
	if getPlayerStorageValue(cid, 37918) >= 1 then
		doTeleportThing(cid, {x = 2705, y = 2308, z = 7}) 
		doPlayerSendTextMessage(cid, "Welcome to Tews Island!") 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must prove yourself worthy of entering Tews Island.")
                doTeleportThing(cid, fromPosition, true)
		end
	return true
end
 
Last edited:
When you put it in you missed putting a value for the storages to be. This is why it didnt work... You have:
if getPlayerStorageValue(cid, 34235) then
it should be:
if getPlayerStorageValue(cid, 34235) >= 1 then -- this is if its greater then or equal to--

- - - Updated - - -

Lua:
function onStepIn(cid, item, position, fromPosition)
if (not isPlayer(cid)) then
doTeleportThing(cid, fromPosition, true) -- this is for monsters, npcs, send them back out of tp.--
return false
end

 if getPlayerStorageValue(cid, 37742) >= 1 then
    doTeleportThing(cid, {x = 2705, y = 2308, z = 7}) 
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Welcome to Tews Island!") 
		else
-- if getPlayerStorageValue(cid, 37742) < 0  the else is saying this. because we had >= 1 for the if --
	  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must prove yourself worthy of entering Tews Island.")
		end
		return true
end

- - - Updated - - -



also in this script... dosetplayersotragevalue is not the command
its setPlayerStorageValue(cid, sotrage, value)


also doPlayerSendTextMessage(cid, "mesasge") dont work. You need
doPlayerSendTextMessage(cid, messageclass, message)
so this is one:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, message)

Lua:
function onStepIn(cid, item, position, fromPosition)
if (not isPlayer(cid)) then
doTeleportThing(cid, fromPosition, true)
return false
end
	setPlayerStorageValue(cid, 37742, 1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have have shown yourself worthy of entering Tews Island!")
    if getPlayerStorageValue(cid, 37742) >= 1 then
	doPlayerSendCancel(cid, "You already shown yourself worthy")
	return true
end
end
 
Last edited:
Back
Top