local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 15)
regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 2000)
regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 15)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 2000)
function onLogin(player)
if player:getStorageValue(XXXXX) == YYY then -- YOUR VIP CONDITION
player:addCondition(regenCondition)
return true
end
end
after being placed on the server I can't login to the gameCreaturescripts:
Lua:local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT) regenCondition:setTicks(-1) regenCondition:setParameter(CONDITION_PARAM_HEALTHGAIN, 15) regenCondition:setParameter(CONDITION_PARAM_HEALTHTICKS, 2000) regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, 15) regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 2000) function onLogin(player) if player:getStorageValue(XXXXX) == YYY then -- YOUR VIP CONDITION player:addCondition(regenCondition) return true end end
Remember register the script in login.lua
<event type="login" name="regenStorage" script="regen.lua"/>
for i = 1, #events do
player:registerEvent("regenStorage")
end
if player:getStorageValue(XXXXX) == YYY then -- YOUR VIP CONDITION
an storagevalue which is the same as you give to a vip player so XXXXX for example is 123456 and it must be equal to YYY so in this example equal to 123456Make sure to give theif player:getStorageValue(XXXXX) == YYY then -- YOUR VIP CONDITION
an storagevalue which is the same as you give to a vip player so XXXXX for example is 123456 and it must be equal to YYY so in this example equal to 123456
function onLogin(player)
if player:getStorageValue(161398) < 1 then -- YOUR VIP CONDITION
player:addCondition(regenCondition)
return true
end
end
The StorageValue has to match the VIP storageValuefunction onLogin(player) if player:getStorageValue(161398) < 1 then -- YOUR VIP CONDITION player:addCondition(regenCondition) return true end end
I put it like this
The StorageValue has to match the VIP storageValue
function onLogin(player)
if player:getStorageValue(161398) == 161398 then -- YOUR VIP CONDITION
player:addCondition(regenCondition)
return true
end
end
Did you register the script in login.lua? If isn't registered, it won't work.no work
VIP is almost always used asTry this
Lua:function onLogin(player) if player:getStorageValue(161398) == 161398 then -- YOUR VIP CONDITION player:addCondition(regenCondition) return true end end
os.time()
, it's very unlikely that it would equal the storage number.> 0
was the correct approach.When you say storage is higher than zero, which always, everyone will be VIP.VIP is almost always used asos.time()
, it's very unlikely that it would equal the storage number.
Using> 0
was the correct approach.
yesDid you register the script in login.lua? If isn't registered, it won't work.
VIP is almost always used asos.time()
, it's very unlikely that it would equal the storage number.
Using> 0
was the correct approach.
actions vip
local STORAGE = 161398
local TIME = 60 * 60 * 12
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local cur = math.max(player:getStorageValue(STORAGE) - os.time(), 0)
player:setStorageValue(161398, os.time() + cur + TIME)
item:remove(1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You've activated More regeneration.")
player:getPosition():sendMagicEffect(15)
return true
end
As he said, os.time () is usually used, then the correct one would be:When you say storage is higher than zero, which always, everyone will be VIP.
getStorageValue (161398) > os.time ()
getStorageValue (161398) > os.time ()
True. It's not the best approach, as it would apply for anyone who had used vip before.. but OP's attempt was wildly better then your idea.When you say storage is higher than zero, which always, everyone will be VIP.
if player:getStorageValue(161398) > os.time() then
As he said, os.time () is usually used, then the correct one would be:
Lua:getStorageValue (161398) > os.time ()
Try use this:
Lua:getStorageValue (161398) > os.time ()
the player cannot sign inTrue. It's not the best approach, as it would apply for anyone who had used vip before.. but OP's attempt was wildly better then your idea.
This would be the correct usage in this case.
Lua:if player:getStorageValue(161398) > os.time() then
beautyPersonally I would go for a source edit and doing everything via SQL, it works the same way as getting your vocation id via the database. No performance decrease as it loads only one time each time an account login