Well, this code was created by Empty
It should be works so i wanna post it
First, go to actions.xml and add this:
Code:
<!-- 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
Code:
-- 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
Code:
-- 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
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"/>
And thats all
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:
Code:
-- 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