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

GlobalEvent Vip System

Then use two storages for that:

In login.lua add this:
PHP:
local storTime = 19000
local Stor = 19001
function onLogin(cid)
	if os.difftime(os.time, getPlayerStorageValue(cid, storTime)) >= (24 * 60 * 60 * 1000) then
		setPlayerStorageValue(cid, storTime, 0)
		setPlayerStorageValue(cid, Stor, 0)	
	end
	return TRUE
end

And in your script from VIP add this:

PHP:
setPlayerStorageValue(cid, storTime, os.time())
setPlayerStorageValue(cid, Stor, 1)

Credits:
Nahruto
 
Correction + remove os.difftime cuz I hate it (it's same as -):
PHP:
local storTime = 19000
local Stor = 19001
function onLogin(cid)
    if os.time() - getPlayerStorageValue(cid, storTime) >= (24 * 60 * 60) then
        setPlayerStorageValue(cid, storTime, 0)
        setPlayerStorageValue(cid, Stor, 0)    
    end
    return TRUE
end

And what do you think this will do? Lol... It's just gonna reset the storages after 24 hours?
 
Single scripts

Code:
Vip = {1500}
Vip.__index = Vip

function Vip:SetVip(uid)
return setPlayerStorageValue(uid, Vip[1], 1)
end
 
function Vip:RemoveVip(uid)
return setPlayerStorageValue(uid, Vip[1], -1)
end

function Vip:IsVip(uid)
return (getPlayerStorageValue(uid, Vip[1]) == 1 and TRUE or FALSE)
end
 
Correction + remove os.difftime cuz I hate it (it's same as -):
PHP:
local storTime = 19000
local Stor = 19001
function onLogin(cid)
    if os.time() - getPlayerStorageValue(cid, storTime) >= (24 * 60 * 60) then
        setPlayerStorageValue(cid, storTime, 0)
        setPlayerStorageValue(cid, Stor, 0)    
    end
    return TRUE
end

And what do you think this will do? Lol... It's just gonna reset the storages after 24 hours?

Its made by Nahruto that function, and yes it suppose to take your storage after 24hrs even if you are loged out :D
Nahruto told me that :D AND NAHRUTO ROX!
 
Its made by Nahruto that function, and yes it suppose to take your storage after 24hrs even if you are loged out :D
Nahruto told me that :D AND NAHRUTO ROX!

No plx I am his teacher heuahuae but this is no good solution :)
I made VIP system for him but if he release i kill him hauehae


This solution was bad because it reset WHOLE storage at once ;C
 
No plx I am his teacher heuahuae but this is no good solution :)
I made VIP system for him but if he release i kill him hauehae


This solution was bad because it reset WHOLE storage at once ;C

auhauhau he told me make this, i didnt created the solution ^.-
 
remove all globalevents and use that login.lua:

Code:
--[[

ADD IT TO lib/constant.lua:
firstPlayerLoggedIn = 0

]]--

function onLogin(cid)

    if firstPlayerLoggedIn == 0 then
        local list = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `player_storage`.`key` = '11551' AND `player_storage`.`value` > '0';")
        if(list:getID() ~= -1) then
            while(true) do
                local days = list:getDataInt("value")
                local playerGUID = list:getDataInt("player_id")
                db.executeQuery("UPDATE `player_storage` SET `value` = '" .. days - 1 .. "' WHERE `player_storage`.`player_id` = '" .. playerGUID .. "' AND `player_storage`.`key` = '11551';")
                if not(list:next()) then
                    break
                end
            end
            list:free()
        end
        firstPlayerLoggedIn = 1
    end

    registerCreatureEvent(cid, "PlayerDeath")
    return TRUE
end

Don't forggot to add firstPlayerLoggedIn = 0 to lib/constant.lua
 
Last edited:
remove all globalevents and use that login.lua:

Code:
--[[

ADD IT TO lib/constant.lua:
firstPlayerLoggedIn = 0

]]--

function onLogin(cid)

    if firstPlayerLoggedIn == 0 then
        local list = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `player_storage`.`key` = '11551' AND `player_storage`.`value` > '0';")
        if(list:getID() ~= -1) then
            while(true) do
                local days = list:getDataInt("value")
                local playerGUID = list:getDataInt("player_id")
                db.executeQuery("UPDATE `player_storage` SET `value` = '" .. days - 1 .. "' WHERE `player_storage`.`player_id` = '" .. playerGUID .. "' AND `player_storage`.`key` = '11551';")
                if not(list:next()) then
                    break
                end
            end
            list:free()
        end
        firstPlayerLoggedIn = 1
    end

    registerCreatureEvent(cid, "PlayerDeath")
    return TRUE
end

Don't forggot to add firstPlayerLoggedIn = 0 to lib/constant.lua
how does this line work with

Code:
			setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))

Code:
db.executeQuery("UPDATE `player_storage` SET `value` = '" .. days - 1 .. "' WHERE `player_storage`.`player_id` = '" .. playerGUID .. "' AND `player_storage`.`key` = '11551';")
 
is it possible to make it a talkaction like !vip "name,days
/Danne
 
is there any working tile script that works with this script
like a donator tile if u got the storage id u can walk on it and get tped?
/Danne

i made a script and i worked with other storageid but with the vip script it didnt :S dont know whats wrong are u sure that the script give u the right storage id ?
 
Last edited by a moderator:
grr

Code:
function onStepIn(cid, item, pos)
    if item.uid == 11552 and item.itemid == 1397 then
        if getPlayerStorageValue(cid,11551) == 1 then
			local pos = {x=33806, y=31977, z=7}
			doTeleportThing(cid,pos)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are a vip! You may pass.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, you are not a vip. u can buy it on the homepage!')
			local pos2 = {x=32379, y=32240, z=7}
			doTeleportThing(cid,pos2)
        end
    end
    return 1
end

whats wrong with this code !! when i try walk on the mystic flame it only send me a msg Sorry, you are not a vip. u can buy it on homepage!

/Danne
 
Code:
function onStepIn(cid, item, pos)
    if item.uid == 11552 and item.itemid == 1397 then
        if getPlayerStorageValue(cid,11551) <= 1 then
			local pos = {x=33806, y=31977, z=7}
			doTeleportThing(cid,pos)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are a vip! You may pass.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, you are not a vip. u can buy it on the homepage!')
			local pos2 = {x=32379, y=32240, z=7}
			doTeleportThing(cid,pos2)
        end
    end
    return 1
end

:>
 
Code:
function onStepIn(cid, item, pos)
    if item.uid == 11552 and item.itemid == 1397 then
        if getPlayerStorageValue(cid,11551) <= 1 then
			local pos = {x=33806, y=31977, z=7}
			doTeleportThing(cid,pos)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are a vip! You may pass.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, you are not a vip. u can buy it on the homepage!')
			local pos2 = {x=32379, y=32240, z=7}
			doTeleportThing(cid,pos2)
        end
    end
    return 1
end

:>
i like u :) thx for all help rep++
 

Similar threads

Back
Top