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

Lua Vip Save Location

Ahead

New Member
Joined
Dec 27, 2013
Messages
165
Reaction score
2
Imagine a VIP Player saves in the VIP City, it could be possible to make him save "forcibly" (with a script) in Thais (for example) when his Vip Days have gone?. Like a position reset.

I mean to not allow him the fact of keep the savepoint in the VIP City while not being VIP.

You suppose i am using a StorageID VIP System.

Thank you!
 
give him second storage which will tell you if he was vip

eg. you set storage 49697 with key 1 when player gets vip(eg by using vip medal or whatever)
and add something to login.lua to check if he is still vip
code may work like this:
if 49697(storage) is 1 and player is not vip then set 49697 to 0 and tp player to temple
 
give him second storage which will tell you if he was vip

eg. you set storage 49697 with key 1 when player gets vip(eg by using vip medal or whatever)
and add something to login.lua to check if he is still vip
code may work like this:
if 49697(storage) is 1 and player is not vip then set 49697 to 0 and tp player to temple

I know i have to learn and i wrote it in a .txt how it could be :P. But i have no idea of how really make it works, i mean, how would be the codes for:

- "Player is not vip" (maybe something with check?).
- Set the storageid to 0.
- Tp to temple.

I have no schemes so if you plus it i have no idea of scripting... S:

Thank you again zbizu.
 
- just tell me how you check player vip status(is or isn't vip) - you have vip areas so I assume you have method to check if player is vip
- I meant setPlayerStorageValue(cid, 49697, 0)
- Player(cid):teleportTo(Town(1):getTemplePosition()) - player will be tped to temple in town which has id 1 << works only for TFS 1.0
 
- just tell me how you check player vip status(is or isn't vip) - you have vip areas so I assume you have method to check if player is vip

Hmm, i have not done it yet but i suppose it would be by... hmm.. storage id 199413 (how can i know the free values?)

- Player(cid):teleportTo(Town(1):getTemplePosition()) - player will be tped to temple in town which has id 1 << works only for TFS 1.0

So, since i have the signature i have, i am f¨¨ked?
 
- you have to check them manually, every storage/aid/uid I add to my datapack I add also to my personal value index(txt file) to avoid duplicates and when I add new thing I check if number is free.

- no, for 0.3.7 it's:
doTeleportThing(cid,getTownTemplePosition(1))
 
Would it works?

Code:
    if getPlayerStorageValue(cid, 199413) == 1 then
            setPlayerStorageValue(cid, 199413, 0) and doTeleportThing(cid,getTownTemplePosition(2))
        end
    end

But 1 = yes or no?

Because if it checks a player with 199413 ID it should not remove his VIP days xDDD.
 
Code:
function isPlayerVip(cid)
if (check somehow if vip time left is < 0) then
return false
else
return true
end
end

Code:
if getPlayerStorageValue(cid, 199413) == 1 and (not isPlayerVip(cid)) then
setPlayerStorageValue(cid, 199413, 0)
doTeleportThing(cid,getTownTemplePosition(2))
end
 
first code:
for vip functions you should create lib file(data\lib\your_lib_name.lua), because you will use them later also(not only in this script)

second code:
yes, should be below function onLogin(cid) and above return true
 
Code:
function isPlayerVip(cid)
if (check somehow if vip time left is < 0) then
return false
else
return true
end
end

Console says to me an error:

')' expected near "somehow"

(Did you put somehow as expression or is it valid inside the code? haha)

S:
 
Last edited:
I expected you to put method you use to get amount of player's vip days left. I didn't knew you take it as ready to run code.
Let's start again
how the fuck you store amount of vip days left?
 
I expected you to put method you use to get amount of player's vip days left. I didn't knew you take it as ready to run code.
Let's start again
how the fuck you store amount of vip days left?

Hmm, i do not know, i have this script which gives me X vip days. I suppose that by pass of real time they disappear, don't they?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,199413) < 1 then
if getPlayerLevel(cid) > 8 then
getPlayerStorageValue(cid, 199413)
doCreatureSay(cid, "You received the VIP status for 1 day.", TALKTYPE_MONSTER)
setPlayerStorageValue(cid, 199413, (getPlayerStorageValue(cid,199413) + 1))
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 8 to use this.")
end
else
doPlayerSendCancel(cid,"You are already a VIP player.")
end 
return TRUE
end
 
even better

now your function is:
Code:
function isPlayerVip(cid)
return getPlayerStorageValue(cid,13540) > 0
end
 
It did not show any error. I will test it, i already use a VIP Doll with a character, so i am going to see tomorrow if it worked.

Last question, to make a teleport just usable by an storageID, the number is put in action id or unique id?
 
Depending on your choice.
If you decide to place more than one teleport with same script use actionid(uid can't be duplicated)
Uniqueid is for items that won't be duplicated such as quest tiles or levers.

in isPlayrerVip use storage you set for vip days.
To move players to temple onLogin use different storage which will hold only 0 and 1 values.

Pls learn some lua urself, it isn't that hard
 
Will this Script work on TFS 1.0? :O
Did not notice that he was using 1.0.
Should not be that hard to make it into 1.0, if you install it and wait and see what types of bugs you get.

And if I remember correctly, @zbizu made a version of some vip system for 1.0, correct?
 
Back
Top