• 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 [TFS 0.X] Creaturescript its not removing storage

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,403
Solutions
17
Reaction score
151
Location
Brazil
Guys, I have a strange problem, I thought it was simple but maybe it's not. I tried to put in my script to activate VIP to set a storage for the players and I have a creaturescript that validates this VIP, and if the time is up it removes it. The problem is that if I put it in the VIP action to put the storage in the player, the creaturescript can't remove it afterwards. If I just let the creaturescript set the storage, then he can remove it, the problem is that after using it the player needs to relog. Works only with creaturescript:

Lua:
function onLogin(cid)
pos = {x=160, y=54, z=7}
    if isVIP(cid) == true then
        setPlayerStorageValue(cid, 830009, 1)
        setPlayerStorageValue(cid, 30009, 1)
    elseif getPlayerStorageValue(cid, 830009) > 0 and isVIP(cid) == false then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your VIP time is over, renew to continue enjoying all the VIP benefits.")
        setPlayerStorageValue(cid, 830009, -1)
        setPlayerStorageValue(cid, 30009)
        doTeleportThing(cid,pos)
        doPlayerSetTown(cid,1)
    end
    return true
end

And i have this action to VIP:
Lua:
local days = 30

function onUse(cid, item, fromPosition, itemEx, toPosition)
  setAccountVIP(cid, days)
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you've added " .. days .. " VIP days to this account! Please relog your character to activate.")
  doRemoveItem(item.uid, 1)
  doPlayerSave(cid)
  return true
end
If i put in action SCRIPT this line
Lua:
setPlayerStorageValue(cid, 30009, 1)
The creaturescript doesn't remove the storage if the VIP runs out. I wanted the storage 30009 to be activated when using the item in the action, without the player needing to relog, and then it would be removed normally by the creaturescript.
 
Back
Top