• 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!

CreatureEvent Tfs[1.x] Trial Vip

luhfe

New Member
Joined
Apr 26, 2018
Messages
48
Reaction score
2
I was 2 days messing with this type of script because everyone I thought was an error or abuse if the server closed or simply did not work on the VIP system per account ('VipDays' table in the database).
so I checked all the functions on my server and created this code.
I am newbie so the code is very simple but even the server falling or creating another character had no problem or any other abuse.

How install :
YOU SHOULD CREATE A DATABASE FIELD IN 'ACCOUNTS' WITH NAME 'ACCOUNT_STORAGE' BOOLEAN (works to me) NOT NULL.
You need only add this to the "Login.lua" file inside the "Creaturescript" / "Script" folder (or subfolders) after "function onLogin (player)" or any similar code however within this function (remembering to respect the 'ends' not to give error), maybe only copy and paste

What do :
will select in database a field account_storage (thats is we use to check if players has be get the bonus days) where the id of account is the same of account_id of player login.
alocate the value of field in Var local 'accountS'.
check if is diferent of 1 (0 or any other value) and lastlogin (if player dont login any time - first login check)
add vips (Define the days in var local 'daysv') and set in database account_storage field to 1, in next login the players with this account(account_storage = 1) will not receive the 'Trial'.
last line is only to send message to player.
Lets go to what matters :

Lua:
    -- Vip Trial --
local Info = db.storeQuery("SELECT `account_storage` FROM `accounts` WHERE `id` = " .. player:getAccountId() ..";")
local accountS = result.getNumber(Info, "account_storage")
        if accountS ~= 1 and player:getLastLoginSaved() <= 0 then
local daysv = 3
        player:addVipDays(daysv)
        db.storeQuery("UPDATE accounts SET account_storage = 1 WHERE id = " .. player:getAccountId() .. ";")
    player:sendTextMessage(messageType or MESSAGE_STATUS_CONSOLE_ORANGE, '[VIP] You received 3 days vip bonus, Enjoy. [VIP]')
else
    player:sendTextMessage(messageType or MESSAGE_STATUS_CONSOLE_ORANGE, '[VIP] You has received the bonus Vip before, Get account vip scroll in Store. [VIP]')
end
-- End Vip Trial --

Bônus tip : have found the codes in login.php and make this one. its only to send a player how much days of vip he has left.
Code:
-- Vip Check --
    local days = player:getVipDays()
    if days ~= 0 then
        player:sendTextMessage(MESSAGE_EVENT_ORANGE,string.format('[VIP] You have %s days of VIP left. [VIP]', (days == 0xFFFF and 'infinite amount of' or days), (days == 1 and '' or 's')))
        else
        player:sendTextMessage(MESSAGE_EVENT_ORANGE,string.format('[VIP] You are not VIP, Get the vip scroll time in Store ! [VIP]'))
    return true
end
-- End Vip Check --

remember, i'm noob n only want help who's help me (in case OtLand community), ty all. cya
 
Back
Top