Ramirow
Veteran OT User
- Joined
- Aug 22, 2009
- Messages
- 584
- Solutions
- 15
- Reaction score
- 301
- Location
- Argentina
- YouTube
- ramirogrant
Hello guys! First of all, I've made this script for my server (I'm using Kekox VIP System btw), it works this way:
- It gives 3 vip days to your account
- Saves the value in the Account of the player (So it can only be done once per account to avoid abuse)
Well, first of all we need to add some functions..
- Go to (yourServerFolder)/data/lib/050-function.lua
- Add these:
Now that you have the functions..In order for this to work, we must create a new table in your MySql database.
- Open PhpMyAdmin
- Select your server database and execute the following query:
We are good to go now! I implemented this with a chest, you can use the functions in any way you see fit, talkactions, moveevents, creaturescripts..
Anyways, my script for the chest is the following:
Hope you like it, tested in TFS 0.4 rev 3777
I modified the VIP System to work with hours, not days, so you will have to edit the scripts to fit your server.
- It gives 3 vip days to your account
- Saves the value in the Account of the player (So it can only be done once per account to avoid abuse)
Well, first of all we need to add some functions..
- Go to (yourServerFolder)/data/lib/050-function.lua
- Add these:
Code:
function getPlayerAccountStorage(cid)
local Info = db.getResult("SELECT `account_storage` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local value= Info:getDataInt("account_storage")
Info:free()
return value
end
return LUA_ERROR
end
function doAddAccountStorage(cid, value)
db.executeQuery("UPDATE `accounts` SET `account_storage` = " .. value .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
Now that you have the functions..In order for this to work, we must create a new table in your MySql database.
- Open PhpMyAdmin
- Select your server database and execute the following query:
Code:
ALTER TABLE `accounts` ADD `account_storage` int(11);
We are good to go now! I implemented this with a chest, you can use the functions in any way you see fit, talkactions, moveevents, creaturescripts..
Anyways, my script for the chest is the following:
Code:
function onUse(cid, item, frompos, item2, topos)
if getPlayerAccountStorage(cid) >= 1 then
doPlayerPopupFYI(cid, "Lo sentimos, ya has reclamado tiempo VIP para tu account.")
else
doAddAccountStorage(cid, 1)
doAddVipDays(cid, 72)
doPlayerPopupFYI(cid, "Has agregado 72 horas/3 dias de VIP a tu account!\nAdemas, recibiras un +15% bonus de exp\nDisfrutalo!\nPhoenix OTS")
end
return true
end
Hope you like it, tested in TFS 0.4 rev 3777
I modified the VIP System to work with hours, not days, so you will have to edit the scripts to fit your server.