Thank you for your respect in speaking and I will try follow the steps you gave me and if I dont succeed I will follow tibia on 1 player can enter per accountDear El Man,
You will need to rewrite the premium script in Lua and you need to rewrite a few parts in the C++ player.cpp file in order to make this work good. Also you will need to make changes how you will identify it in the database. Now it is set to the account, if the account has X days of premium left. You will need to make it a JSON for example so you can have it add the player and then make the premium function to read it from JSON from the database.
Description can be feel a bit odd, but trying to make it as best of understanding.
Also I might have missed a few things, its a good headstart to go and where to search for and how you would want to refactor it.
Kind regards,
Ralumbi
local config = {
storageTime = 677777
}
function onLogin(cid)
local time = tonumber(getCreatureStorage(cid, config.storageTime)) or -1
if time == -1 then
doPlayerAddPremiumDays(cid, -getPlayerPremiumDays(cid))
return true
elseif time >= os.time() then
doPlayerAddPremiumDays(cid, 999)
return true
end
return true
end
--[[ XML:
<event type="login" name="PremiumPerPlayer" script="premiumPerPlayer.lua" />
]]
--[[ data/lib/050-function.lua
function setPlayerCustomPremiumDays(days)
doPlayerAddPremiumDays(cid, -getPlayerPremiumDays(cid))
doPlayerAddPremiumDays(cid, 999)
doCreatureSetStorage(cid, config.storageTime, os.time() + days * 86400)
end
]]
local creatureEvent = CreatureEvent("premiumPerPlayer")
function creatureEvent.onLogin(player)
local time = tonumber(player:getStorageValue(config.storageTime)) or -1
if time == -1 then
player:setPremiumTime(0)
return true
elseif time >= os.time() then
player:addPremiumDays(999)
return true
end
return true
end
creatureEvent:register()
function Player:setCustomPremiumDays(days)
self:setPremiumTime(0)
self:addPremiumDays(days)
self:setStorageValue(config.storageTime, os.time() + days * 86400)
end