• 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 Only one player can pass trough the doors (TFS 0.4)

marek12

Available for sprite works
Joined
Apr 8, 2020
Messages
398
Solutions
4
Reaction score
394
Hi guys,

I am looking for a script that will allow only one player pass trough doors and only him or all the players on this one account.
I made an alter table in players called "room" in my database, what I am trying to do now is to allow the player to buy access to any room for 12hours.
Every room has it's own number so players know which room is which.
Now let's say player stay in front of room number 1 and type a command and buys it, now how do I make it that only him(or all players on same account) can access this room?

I don't know if I should do it with storage values or in database?
From what I know, If I want all the players in same account access this room it probably needs to be done in database(lua script but with db.Query function as well as creating new tables in db).
Would be also nice if I can make it work so if one player buy access to room 1, then if other player try to buy the same room it will show the cancel saying "Player XXX is owning this room at the moment".

I will be extremely thankful for your help. :3
Trying to learn new stuff all the time, I learned some lua in the past and now wanted try to something a bit harder, but unfortunately I don't know how to do it :D
 
You'd have to use an 'account storage'.

Once you have that installed and available to use,

You'd want to use a combination of a global_storage and the account storage with os.time().
Account storage let's all players on account access the area.
Global storage disallows other players from buying that area when it's already purchased.
 
You'd have to use an 'account storage'.

Once you have that installed and available to use,

You'd want to use a combination of a global_storage and the account storage with os.time().
Account storage let's all players on account access the area.
Global storage disallows other players from buying that area when it's already purchased.
will give it a try now and msg back soon :D
Post automatically merged:

You'd have to use an 'account storage'.

Once you have that installed and available to use,

You'd want to use a combination of a global_storage and the account storage with os.time().
Account storage let's all players on account access the area.
Global storage disallows other players from buying that area when it's already purchased.
how do I use global storage? can you explain a bit more? what it does and where should I place it? should I use global storage on doors, or on player?
Post automatically merged:

and can I still use setPlayerStorageValue(cid)? or do I need to set account storage now? I bet is setAccountStorageValue(accid, key) now and It won't work with with only player got this value, right?
 
Last edited:
Back
Top