potinho
Advanced OT User
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:
And i have this action to VIP:
If i put in action SCRIPT this line
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.
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
Lua:
setPlayerStorageValue(cid, 30009, 1)