• 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 What is this script looking for?

dominique120

Science & Reason
Senator
Premium User
Joined
Jun 16, 2013
Messages
3,881
Solutions
3
Reaction score
1,046
Location
Númenor
I have this script that has this "vipstatus = getPlayerStorageValue(cid,storageValue)". My question is where is the "vipstatus" value stored?

TFS version is 0.3.6 Build 3429

Here is the script, and another one that has the same "getPlayerStorageValue" and the number "21444"

I dont know if this is a problem with a missing table in the database because I dont get any errors that apear related to it, only this one

Code:
mysql_real_query(): SELECT `id`, `ownerid`, `creationdata`, `checkdata` FROM `guilds` WHERE `world_id` = 0; - MYSQL ERROR: Unknown column 'checkdata' in 'field list' (1054)

Here are the scripts:

Code:
function onUse(cid, item, frompos, item2, topos)
local storageValue = 21444
vipstatus = getPlayerStorageValue(cid,storageValue)
if vipstatus == 1 then
    doTransformItem(item.uid, item.itemid + 1)
    playerpos = getPlayerPosition(cid)
    doorpos = {x = frompos.x, y = frompos.y, z = frompos.z, stackpos = 253}
    if playerpos.y == doorpos.y + 1 and playerpos.x == doorpos.x then
        doMoveCreature(cid, 0)
        doMoveCreature(cid, 0)
    elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y then
        doMoveCreature(cid, 1)
    elseif playerpos.y == doorpos.y - 1 and playerpos.x == doorpos.x then
        doMoveCreature(cid, 2)
        doMoveCreature(cid, 2)
    elseif playerpos.y == doorpos.y and playerpos.x == doorpos.x + 1 then
        doMoveCreature(cid, 3)
    elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y - 1 then
        doMoveCreature(cid, 4)
        doMoveCreature(cid, 2)
    elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y - 1 then
        doMoveCreature(cid, 5)
        doMoveCreature(cid, 2)
    elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y + 1 then
        doMoveCreature(cid, 6)
        doMoveCreature(cid, 0)
    elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y + 1 then
        doMoveCreature(cid, 7)
        doMoveCreature(cid, 0)
    end
else
    doCreatureSay(cid, "You are not a VIP.", TALKTYPE_ORANGE_1)
end
return 1
end

Code:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 5785 then
        if (getPlayerStorageValue(cid,21444) < 1) then
            local playerpos = getCreaturePosition(cid)
            doRemoveItem(item.uid,5785)
            setPlayerStorageValue(cid,21444,1)
   
            doSendMagicEffect(playerpos, 29)
            doCreatureSay(cid, "Congrats! You now own the VIP acces token", TALKTYPE_ORANGE_1)
        else
            doCreatureSay(cid, "You already are a VIP", TALKTYPE_ORANGE_1)
        end
    end
end

Thanks!
 
vipstatus is not stored anywhere, it is a variable used as a condition

Code:
local storageValue = 21444
vipstatus = getPlayerStorageValue(cid,storageValue)
if vipstatus == 1 then

or:

Code:
vipstatus = getPlayerStorageValue(cid,21444)
if vipstatus == 1 then

or:

Code:
if getPlayerStorageValue(cid,21444) == 1 then

Are the same.

I'm guessing storage value 21444 is the value used to check if someone is vip or not.
 
@Santi then how can I make a player vip for a specific time? Is this value stored temporarily on ram? so when I restart the server, all vips become normal players? Help me out please.
 
The value is stored in the database, so don't worry it will reload everytime your restart your server.
To make a player vip for a certain ammount of time you might use a globalevent to set the storage back to -1 (none), or you could make the storage value 30 (In case you want 30 days) and then remove 1 vip day per SS.

Code:
vip = getPlayerStorageValue(pid, 21444)
function onTime()
for _,pid in ipairs(getPlayersOnline()) do
if vip > 0 then
setPlayerStorageValue(cid, vip == 1 and -1 or vip-1)
end
end
return true
end

It's been a long time so I'm not certain if this is even ok, but someone else might check it out and fix it.
 
@Santi, so I should create a new global event scipt and register it in the xml, but what interval should I use? And if it is in the database where is this value stored? what is the name of the table, column, or row?
 
Forget about it, I removed this vip system and used another one that has entries in the database. Thanks for your help!
 
Back
Top