• 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 Storage Value

freaked1

Active Member
Joined
Jan 30, 2008
Messages
486
Solutions
5
Reaction score
30
Location
Sweden
Hello! How can I make a door that will only let people with storageID xxxx in?

I'm trying to make a little script but since I'm a noob I need someones help with this ^^

Rep++ as allways if you help :)
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   return getPlayerStorageValue(cid, XXXX) != -1 and doTeleportThing(cid, toPosition) or doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "GTFO!, faggot")
end

Not tested, change the XXXX to the storagevalue, and the message.
 
Okey I ment a Tile, with movement(onStepIn) :P Sorry I'm pretty gone today xD
Lets say it is going to teleport me to x=1000, y=1000, z=7.
And it is Tile 415 that I'm going to step on to get teleported.

And when I step on that tile it will check if I have the storageID xxxx before it teleports me to the position mentioned above.

Sorry for taking your time making the script above. Rep++ anyway
 
add in /data/movements/movements.xml

Code:
<movevent type="StepIn" itemid="415" event="script" value="teleportTile.lua"/>

and /data/movements/scripts/teleportTile.lua

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   local newPosition = {x = 1000, y = 1000, z = 7}
   return getPlayerStorageValue(cid, XXXX) ~= -1 and doTeleportThing(cid, toPosition) or doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "GTFO!, faggot")
end

Edit the position, the message, the storageid.

PD: I would recommend you to use actionid or uniqueid instead of itemid, since that teleport will try to teleport the player in EVERY tile 415.

Edit: Sorry, changed != to ~=, fucked C++.
 
Last edited:
add in /data/movements/movements.xml

Code:
<movevent type="StepIn" itemid="415" event="script" value="teleportTile.lua"/>

and /data/movements/scripts/teleportTile.lua

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   local newPosition = {x = 1000, y = 1000, z = 7}
   return getPlayerStorageValue(cid, XXXX) ~= -1 and doTeleportThing(cid, toPosition) or doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "GTFO!, faggot")
end

Edit the position, the message, the storageid.

PD: I would recommend you to use actionid or uniqueid instead of itemid, since that teleport will try to teleport the player in EVERY tile 415.

Edit: Sorry, changed != to ~=, fucked C++.
Okey I changed to an ActionID but when I step on the tile nothing happens :P
This is what I put
Movements.xml
Code:
<movevent type="StepIn" actionid="3504" event="script" value="djinnenter.lua"/>
djinnenter.lua
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   local newPosition = {x = 789, y = 1102, z = 7}
   return getPlayerStorageValue(cid, 9999) ~= -1 and doTeleportThing(cid, toPosition) or 

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have to complete the Djinn-Tower 

Quest before entering")
end
I get no error in console tho, I did put actionID 3504 in RME.
I had almost a script like that but I used/tried "==" "=>" "=" where it should be "~=" And I used "if" "then" "else" :P But since I had "==" "=>" "=" it f*cked up xD but I don't think that I made it right anyway, just saying :)

PS I'm using 0.3.5
 
Guess I'll have to bump :P
I would also appreciate if someone could give me a link to a C++ program that can be used for TFS scripts ;) with parameters would be great. Those I found had broken link or wasn't for version 0.3.5 :/
Thanks in advance!
 
Last edited:
100% fail proof lol.
jk.
but seriously it should work

rep+++

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local newPosition = {x = 502, y = 504, z = 7}
queststatus1 = getPlayerStorageValue(cid,6001)
if queststatus1 == 1 then

doTeleportThing(cid, newPosition)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have to complete the Djinn-Tower Quest before entering")
end
end
 
this codes is based on the fact that you are setting your storage value equal to 1 which usually happens if you were to use a chest for instance

once you open the chest, you get your items (etc.), and sets your uniqueid/storage value to 1
 
Thank you man ;) I know how to put it. It was just the script that didn't work :)
Rep++ for both you that helped me.
Thanks again for the script :)
 
Back
Top