Pitufo™
InfinityOT.com
Well i made this function based on Azi's and for request of Ates.tr
Tested and worked with TFS 0.3 Beta2
Functions:
getAccountPoints(cid)
doAddPoints(cid, points)
doRemovePoints(cid, points)
Scripts:
Go to data/lib/ and open function.lua and add this functions:
getAccountPoints:
doAddPoints(cid, points)
doRemovePoints:
Example of functions:
In talkaction:
Buy crystal coins with Premium Points
Buy Premium Points(VIP)
Why i made this?
So people can buy things in-game too instead of buying it in website...
You can make the script you whant with that functions!
Enjoy it!
Credits:
Pitufo/Salchicha/Haifurer - For making the functions(All of those names its me)
Azi - Giving function base a
Rep++++?
Tested and worked with TFS 0.3 Beta2
Functions:
getAccountPoints(cid)
doAddPoints(cid, points)
doRemovePoints(cid, points)
Scripts:
Go to data/lib/ and open function.lua and add this functions:
getAccountPoints:
PHP:
function getAccountPoints(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
doAddPoints(cid, points)
PHP:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
doRemovePoints:
PHP:
function doRemovePoints(cid, points)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
db.executeQuery("UPDATE accounts SET premium_points = - " .. points .. " WHERE id=" .. getPlayerAccountId(cid) .. ";")
Info:free()
return 1
end
end
Example of functions:
In talkaction:
Buy crystal coins with Premium Points
PHP:
function onSay(cid, words, param)
if getAccountPoints(cid) >= 5 then
doPlayerAddItem(cid,2160,100)
doRemovePoints(cid, 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You exchanged 2 Premium Points for 100 crystal coints!")
else
doPlayerSendCancel(cid, "You don\'t have enough Premium Points!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return TRUE
end
Buy Premium Points(VIP)
PHP:
function onSay(cid, words, param)
if getPlayerItemCount(cid, 2160) >= 5 then
doPlayerRemoveItem(cid, 2160, 5)
doAddPoints(cid, 10)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought 10 days of VIP")
else
doPlayerSendCancel(cid, "You don\'t have the items to buy Premium Points!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return TRUE
end
Why i made this?
So people can buy things in-game too instead of buying it in website...
You can make the script you whant with that functions!
Enjoy it!
Credits:
Pitufo/Salchicha/Haifurer - For making the functions(All of those names its me)
Azi - Giving function base a
Rep++++?
Last edited: