• 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

StreamSide

Joseluis Gonzalez
Staff member
Support Team
Joined
Aug 31, 2007
Messages
3,608
Solutions
51
Reaction score
1,224
Location
Arica - Chile
Well, this code was created by Empty :D
It should be works so i wanna post it :)

First, go to actions.xml and add this:
XML:
<!-- VipSystem (Credits StreamSide and Empty) --!>
<action actionid="5788" script="other/vip door.lua" />
<action itemid="XXXX" script="other/vip.lua"/>
Change the XXXX for your item, I use 5785 (medal of honour).

then go to actions/scripts/other and create 2 lua files
1.- vipdoor.lua
Lua:
-- Credits StreamSide and Empty
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local cidPosition = getCreaturePosition(cid)
        if (item.actionid == 5788 and getPlayerStorageValue(cid,11551) >= 1) then
            if cidPosition.x < toPosition.x then
                doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
                                doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
            else
                doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
                                doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
            end
            return TRUE
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but only VIP Players can pass here! Buy VIP on the WEB.")
            return TRUE
    end
    return FALSE
end

2.- vip.lua
Lua:
-- Credits StreamSide and Empty
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED)
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 15 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    else
        doPlayerSendCancel(cid,"You are already a donator.")
    end   
return TRUE
end

Also you can change this: "if getPlayerLevel(cid) > 1 then" for the determinated level...

OK, then go to globalevents/scripts and create 2 lua files

1.- removevipdays.lua
Lua:
-- Credits StreamSide and Empty
function onThink(cid, item, fromPosition, toPosition)

    for _, name in ipairs(getOnlinePlayers()) do
        local player = getPlayerByName(name)
        if getPlayerStorageValue(player,11551) > 1 then
            setPlayerStorageValue(player,11551,getPlayerStorageValue(player) - 1)
        end
    end
end

2.- removevip.lua
Lua:
-- Credits StreamSide and Empty
function onThink(cid, item, fromPosition, toPosition)

    for _, name in ipairs(getOnlinePlayers()) do
        local player = getPlayerByName(name)
        if getPlayerStorageValue(player,11551) == 1 then
            setPlayerStorageValue(player,11551,0)
        end
    end
end

And in globalevents.xml add this:
XML:
    <!-- VipSystem (Credits StreamSide and Empty) --!>
    <globalevent name="checkvip" interval="86400000" script="removevipdays.lua"/>
    <globalevent name="removevip" interval="36000000" script="removevip.lua"/>

And thats all :D
If you like it, REP ME PLZ XDD

StreamSide Here...

And if you wanna a broadcast for the VIP Player edit the vip.lua and copy this:
Lua:
-- Credits StreamSide, Empty and Kaorus
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED)
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 15 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("CONGRATULATIONS " ..  name .. "! Now you are VIP for 15 days! Now you can enter the VIP-area and use unique features!")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end   
return TRUE
end

P.S.: Thanks Kaorus and Empty
 
Last edited by a moderator:
You can add a broadcast?

Example_

12:42 XXXXX is now a vip player, congratulations!
 
You can add a broadcast?

Example_

12:42 XXXXX is now a vip player, congratulations!

Yeah :D
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 15 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("CONGRATULATIONS " ..  name .. "! Now you are VIP for 15 days! Now you can enter the VIP-area and use unique features!")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end    
return TRUE
end

Also i remove the "you are already a donator" for if the player wanna anothers 15 days :D
 
Last edited:
Yeah great coding here, but I don't se any uses for it :( There is already premium account ;p but anyway, nice piece of work done ;)
 
Yeah great coding here, but I don't se any uses for it :( There is already premium account ;p but anyway, nice piece of work done ;)

Yes, but if you want premium to be bought in-game as usual, but still want a donation-VIP system you can always use this one. ;)
 
Yeah :D
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 15 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("[COLOR=Red]CONGRATULATIONS " ..  getCreatureName(cid) .. "! Now[/COLOR] you are VIP for 15 days! Now you can enter the VIP-area and use unique features!")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end    
return TRUE
end
Also i remove the "you are already a donator" for if the player wanna anothers 15 days :D

A little fix

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 15 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("CONGRATULATIONS " ..  name .. "! Now you are VIP for 15 days! Now you can enter the VIP-area and use unique features!")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end    
return TRUE
end
 
If i restart the ot, globalevents will restart too or they will continue the time he stoped?
 
Why removevipdays and removevip are separately scripts? I think it can be done in one script :p
edit: You can also use this function to check vip
Code:
function isVip(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isVip: Player not found.")
		return false
	end

	return (getPlayerStorageValue(cid, 11551) > 1)
end

Not tested but should works. Based on isKnight(cid) function :)
 
Last edited:
[Error - GlobalEvents::eek:nThink] Couldn't execute event: checkvip

=/
Got this error
 
[Error - GlobalEvents::eek:nThink] Couldn't execute event: checkvip

=/
Got this error


zednem you used the wrong function is not checkvip, is actually IsVip (cid), an example of it below.

Code:
if isVip(cid) == TRUE then
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
else
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
 
Same error,
[Error - GlobalEvents:nThink] Couldn't execute event: checkvip


in globalevents.xml is like that

<globalevent name="isVIP" interval="300" script="removevipdays.lua"/>
The low interval is for tests

and a have modified i little bit the script, instead of 2 script, i make just one and uses talkaction system to addvip

function onThink(cid, item, fromPosition, toPosition)

for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
if getPlayerStorageValue(player,13540) > 1 then
setPlayerStorageValue(player,13540,getPlayerStorageValue(player) - 1)
elseif getPlayerStorageValue(player,13540) == 1 then
setPlayerStorageValue(player,13540,0)
end
end
end
 
Last edited:
Same error,


in globalevents.xml is like that


The low interval is for tests

and a have modified i little bit the script, instead of 2 script, i make just one and uses talkaction system to addvip

... You shouldn't have. Since they are executed at different times, that's why there is 2 scripts.
 
ok i will put 2 scripts...

EDIT:

Don't changed anything, still with the error
 
So the ot must be online 24h for this scripts works correctly??
but still he doesn't worked here =/

EDIT: i was thinking when i ban a player the time will be over ot online or not, but this is because he is in mysql, so there is a way to make a new table for vip, like bans???
 

Similar threads

Back
Top