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

Action VIP System [0.3.5]

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
This script has been updated and fixed by JDB.
Although it was first edited by Trekes & Kaorus.
And was originally created by Empty.

The Forgotten Server 0.3.4 & 0.3.5
For More Information: http://otland.net/f82/vip-system-19426/

data/actions/actions.xml
PHP:
<action itemid="5807" script="other/vip.lua"/>
<action itemid="5806" script="other/vip.lua"/>
<action itemid="5805" script="other/vip.lua"/>
<action itemid="5785" script="other/vip.lua"/>
data/actions/scripts/other/vip.lua
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg =
{
    [5807] = {amount = (getPlayerStorageValue(cid)+30), days = 30}, -- Bronze Goblet
    [5806] = {amount = (getPlayerStorageValue(cid)+90), days = 60}, -- Silver Goblet
    [5805] = {amount = (getPlayerStorageValue(cid)+180), days = 180}, -- Golden Goblet
    [5785] = {amount = (getPlayerStorageValue(cid)+360), days = 360} -- Medal of Honor
}

local status = 10000
local storage = getPlayerStorageValue(cid, status)
    if (storage == -1) then
        doSendAnimatedText(getCreaturePosition(cid), "+".. cfg[item.itemid].days .." Days", TEXTCOLOR_LIGHTBLUE)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now a VIP Member for ".. cfg[item.itemid].days .." days.")
        setPlayerStorageValue(cid, status, cfg[item.itemid].amount)
        doRemoveItem(item.uid)
    else
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already a VIP member.")
    end
    return true
end

data/globalevents/globalevents.xml
PHP:
<globalevent name="checkVip" interval="86400000" script="removeVipDays.lua"/>
<globalevent name="removeVip" interval="36000000" script="removeVip.lua"/>
data/globalevents/scripts/removeVipDays.lua
Lua:
local storage = 10000
function onThink(cid, item, fromPosition, toPosition)
    for _, name in ipairs(getOnlinePlayers()) do
	local player = getPlayerByName(name)
	if getPlayerStorageValue(player, storage) > 1 then
	    setPlayerStorageValue(player, storage, getPlayerStorageValue(player) - 1)
	end
    end
end

data/globalevents/scripts/removeVip.lua
Lua:
local storage = 10000
function onThink(cid, item, fromPosition, toPosition)
    for _, name in ipairs(getOnlinePlayers()) do
	local player = getPlayerByName(name)
	if getPlayerStorageValue(player, storage) == 1 then
	    setPlayerStorageValue(player, storage, 0)
	end
    end
end

NOTICE:
System has not been tested thoroughly.
If there are problem's, please report them here.
 
Last edited:
Will not work, (getPlayerStorageValue(cid, vip) is outta parameters, and it can't get 'cid' value.
 
That is what was used in the older version and it worked.

How can I change it now?
 
You also dont need Ends on elseif xd

Code:
-- Updated by JDB & Original Idea by Trekes --
-- Config --
local days = 
{ 
    [1] = {vipTime = (getPlayerStorageValue(cid, vipStatus)+ 30), vipItem = 5807 }, -- Bronze Goblet
    [2] = {vipTime = (getPlayerStorageValue(cid, vipStatus)+ 60), vipItem = 5806 }, -- Silver Goblet
    [3] = {vipTime = (getPlayerStorageValue(cid, vipStatus)+ 90), vipItem = 5805 } -- Golden Goblet
}
local vipStatus = 1234
--End Config --
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, vipStatus) == FALSE then
        if (item.itemid == days[1].vipItem) then
            doSendAnimatedText(getCreaturePosition(cid), "VIP", TEXTCOLOR_RED)
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 30 days.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            setPlayerStorageValue(cid, vipStatus, days[1].vipTime)
            doRemoveItem(item.uid, 1)
        elseif (item.itemid == days[2].vipItem) then
            doSendAnimatedText(getCreaturePosition(cid), "VIP", TEXTCOLOR_RED)
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 60 days.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            setPlayerStorageValue(cid, vipStatus, days[2].vipTime)
            doRemoveItem(item.uid, 1)
        elseif (item.itemid == days[3].vipItem) then
            doSendAnimatedText(getCreaturePosition(cid), "VIP", TEXTCOLOR_RED)
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 90 days.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            setPlayerStorageValue(cid, vipStatus, days[3].vipTime)
            doRemoveItem(item.uid, 1)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already a VIP Member.")
    end
    return TRUE
end
 
@Up,
Okay changed.

@Topic,
I was looking at Trekes thread and people said it worked.
I don't know if the storage thing will be a problem or not.
 
Chojrak is wrong, as I see it will work fine.. Its an action so it will return cid value, if it would be a globalevent it woulden't work.

PD: Do not forget to add in global events what Trekes says.
Trekes said:
OK, then go to globalevents/scripts and create 2 lua files

1.- removevipdays.lua
Code:
-- 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
Code:
-- 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:
Code:
    <!-- VipSystem (Credits StreamSide and Empty) --!>
    <globalevent name="checkvip" interval="86400000" script="removevipdays.lua"/>
    <globalevent name="removevip" interval="36000000" script="removevip.lua"/>
 
@Up,
Some of those functions might be outdated,
but it should all be somewhat correct.
 
Error - My forgotten server is 0.3.4 and 0.3.5

PHP:
[11/08/2009 00:08:32] data/actions/scripts/VIP.lua:5: attempt to perform arithmetic on a boolean value
[11/08/2009 00:08:32] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/VIP.lua)
[11/08/2009 00:08:32] data/actions/scripts/VIP.lua:36: 'end' expected (to close 'function' at line 11) near '<eof>'
 
Last edited:
Thank you JDB.. Does it also works for 0.3.5?

Atleast im gonna test it ;) .. Ill let you hear :D

Wodian,,
 
I reloaded actions and it still dont work 0.0 with silver goblet it just opens it so i can type
[11/08/2009 02:32:43] Lua Script Error: [Action Interface]
[11/08/2009 02:32:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 02:32:43] luaGetPlayerStorageValue(). Player not found

[11/08/2009 02:32:43] Lua Script Error: [Action Interface]
[11/08/2009 02:32:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 02:32:43] data/actions/scripts/Custom/vip.lua:5: attempt to perform arithmetic on a boolean value
[11/08/2009 02:32:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)

please fix
 
Last edited:
You can try it now, I changed some things.
 
This script was originally created by Trekes.
All I did was make it more configurable and updated it.

... :eek: It was made by me, he just made some examples... >.<
 
I just got it from his thread, didn't know you made it.
Sorry :wub:
 
Credit added to first post :thumbup:
 
[11/08/2009 10:34:07] Admin Bear has logged in.
[11/08/2009 10:34:13] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:34:13] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'
[11/08/2009 10:34:13] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:34:13] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'
[11/08/2009 10:34:13] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:34:13] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'
[11/08/2009 10:34:13] Reloaded actions.

IDk whats wrong 0.0
 
[11/08/2009 10:40:42] Lua Script Error: [Action Interface]
[11/08/2009 10:40:42] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:42] luaGetPlayerStorageValue(). Player not found

[11/08/2009 10:40:42] Lua Script Error: [Action Interface]
[11/08/2009 10:40:42] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:42] data/actions/scripts/Custom/vip.lua:5: attempt to perform arithmetic on a boolean value
[11/08/2009 10:40:42] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:40:42] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'

[11/08/2009 10:40:42] Lua Script Error: [Action Interface]
[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:43] luaGetPlayerStorageValue(). Player not found

[11/08/2009 10:40:43] Lua Script Error: [Action Interface]
[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua:5: attempt to perform arithmetic on a boolean value
[11/08/2009 10:40:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'

[11/08/2009 10:40:43] Lua Script Error: [Action Interface]
[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:43] luaGetPlayerStorageValue(). Player not found

[11/08/2009 10:40:43] Lua Script Error: [Action Interface]
[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua

[11/08/2009 10:40:43] data/actions/scripts/Custom/vip.lua:5: attempt to perform arithmetic on a boolean value
[11/08/2009 10:40:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Custom/vip.lua)
[11/08/2009 10:40:44] data/actions/scripts/Custom/vip.lua:27: 'end' expected (to close 'function' at line 11) near 'elseif'
[11/08/2009 10:40:44] Reloaded actions.

new error
 
JDB, looks nice, how you steal my vip door script ^_^.
 
Status
Not open for further replies.
Back
Top