• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Buy Shop item (Web) by Talkaction

homarwh

Just a Milan fan.
Joined
Dec 29, 2012
Messages
93
Reaction score
2
Location
Mexico
Hello, this talkaction script was made by "Doggynub" but it was so hided on the forum.
So all the credits go to him.

TESTED ON TFS 0.4

Data/talkactions/scripts and create a .lua named "item1"

Code:
local itemID = 2160
local vipDays = 5
local COST = 5

function onSay(cid, words, param)

local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
local points = query:getDataInt("premium_points")
if points >= COST then
local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points - COST).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
if (update == true) then
doPlayerAddItem(cid, itemID, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought kingdoms wand.")
end
else
doPlayerSendCancel(cid, "You need at least "..vipDays.." shop points to buy this item.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end

CONFIG:
local itemID = ITEM TO GIVE
local vipDays = POINT COST
local COST = POINT COST

now on talkactions.xml
Code:
<talkaction words="!buy-1" event="script" value="item1.lua"/>

When player says "!buy-1" he will buy 1 crystal coin for 5 premium points.

You have to create has much scripts has items you had on your "web shop"
(i dunno edit this to make it all in one script, sorry)

Thanks for watchin.
 
Back
Top