Greetings Otlander's!
Now you would think "what the hell?!".
This is a premium system where you get premium days from premium points (Which you usally get from donations)
Credits:
Kekox - The best VIP system ever - 99% credits to him from this thread
Xavizus - 1% Credits for making this script useable for normal premium
This has been tested in TFS 0.3.6 - Crying Damson!
Okey let's begin!
1.
Usally the sql query: premium_points already exists but just incase!
Add this SQL Query in your phpmyadmin:
2. Now let's go to your function lua(\data\lib\50-function.lua)
Add following at the top:
3. Now, go to your talkaction folder (Data\talkactions\scripts\)
Create a new file with the name: premium.lua
Add follwing lines:
4. Once again, create a new lua file, but with the name: add_points.lua!
Add following lines in to Add_points.lua:
5. Now go back one folder (Data\Talkactions\talkactions.xml)
Open the file Talkactions.xml and add:
--For normal players
--For Gods
6. Now we are done!
Some importent notes:
The god command /addpoints works like this: -DON'T forget the comma.
When the !premium command is used, a file will be created in (Data\logs\premium.txt) so you can see who have bought premium. Example:
*Note Account = 2 (means Account with id 2) - It's an uniq id so don't worry!
ONCE AGAIN:
Credits:
Kekox - The best VIP system ever - 99% credits to him from this thread (1% to me for remaking this)
Xavizus - For making this script useable for normal premium
Now you would think "what the hell?!".
This is a premium system where you get premium days from premium points (Which you usally get from donations)
Credits:
Kekox - The best VIP system ever - 99% credits to him from this thread
Xavizus - 1% Credits for making this script useable for normal premium
This has been tested in TFS 0.3.6 - Crying Damson!
Okey let's begin!
1.
Usally the sql query: premium_points already exists but just incase!
Add this SQL Query in your phpmyadmin:
Code:
ALTER TABLE `accounts` ADD `premium_points` int(11) NOT NULL DEFAULT 0;
2. Now let's go to your function lua(\data\lib\50-function.lua)
Add following at the top:
Lua:
function getPlayerPremiumPoints(cid)
local info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = "..getPlayerAccountId(cid).." LIMIT 1")
if info:getID() ~= LUA_ERROR then
local points= info:getDataInt("premium_points")
info:free()
return points
end
return LUA_ERROR
end
function doAddPremiumPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
end
3. Now, go to your talkaction folder (Data\talkactions\scripts\)
Create a new file with the name: premium.lua
Add follwing lines:
Lua:
function onSay(cid, words, param, channel)
local cfg = {
days = 60, -- Change for how many days that should be added
points = 20 -- Change for how many premium_points it should cost.
}
local playerpoints = getPlayerPremiumPoints(cid)
--------------------------------
if playerpoints >= cfg.points then
doPlayerAddPremiumDays(cid, cfg.days)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` - " .. cfg.points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
local playerpoints = getPlayerPremiumPoints(cid)
doPlayerPopupFYI(cid, "Succesfull added 60 premium days! You have "..playerpoints.." remaining.")
doWriteLogFile('data/logs/premium.txt', 'Account = '..getPlayerAccountId(cid)..' has bought '..cfg.days..' premium days!\n')
else
doPlayerPopupFYI(cid, "You haven\'t enough of premium points!")
end
return false
end
Add following lines in to Add_points.lua:
Lua:
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local t = string.explode(param, ",")
t[1] = tonumber(t[1])
if(not t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
return true
end
local pid = cid
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
if(t[1] > 500) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 500 Premium points.")
return true
end
doAddPremiumPoints(pid, t[1])
doPlayerPopupFYI(cid, "Succsess!")
doPlayerPopupFYI(pid, t[1].."Premium Points have been added to your account!")
return true
end
5. Now go back one folder (Data\Talkactions\talkactions.xml)
Open the file Talkactions.xml and add:
--For normal players
Lua:
<talkaction words="!premium" event="script" value="premium.lua"/>
Lua:
<talkaction log="yes" words="/addpoints" access="5" event="script" value="add_points.lua"/>
6. Now we are done!
Some importent notes:
The god command /addpoints works like this: -DON'T forget the comma.
Code:
/addpoints 30, Xavizus
Code:
[07/07/2010 16:19:56] Account = 2 has bought 60 premium days!
ONCE AGAIN:
Credits:
Kekox - The best VIP system ever - 99% credits to him from this thread (1% to me for remaking this)
Xavizus - For making this script useable for normal premium