• 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!

[help] i need talkaction to buy item look it

Shynzo

Banned User
Joined
Jun 15, 2008
Messages
142
Reaction score
0
Location
Brazil
People i need a small help in this script.
I need a script to buy an item only for premium players and only pay in loss premium days.
I need to TFS 0.3

a small exemple bugged

PHP:
local itemID = 2173
local vipDays = 6
local removeDays = 7

function onSay(cid, words, param)
        if isPremium() then
    else
        doPlayerSendCancel(cid, "You need premium account.")
    else  
        doPlayerRemovePremiumDays(cid, removeDays) == TRUE then
        doPlayerAddItem(cid, itemID, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought more one rare item os in the Server.")
    else
        doPlayerSendCancel(cid, "You need "..vipDays.." to buy this item.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
end
end

Help me in this script please
 
i have this and the two not work


local config = {
itemID = 2173,
vipDays = 7
}

function onSay(cid, words, param)
if getPlayerPremiumDays(cid) <= config.vipDays then
if doPlayerRemovePremiumDays(cid, config.vipDays) == TRUE then
doPlayerAddItem(cid, config.itemID, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have buyied a ITEM Name.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
else
doPlayerSendCancel(cid, "You need "..config.vipDays.." days of Vip to buy this item.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need "..config.vipDays.." days of Vip to buy this item.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
end
end
end
 
try
Lua:
local itemID = 2173
local vipDays = 7
local COST = 6

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 more one rare item os in the Server.")
          end 
		else
           doPlayerSendCancel(cid, "You need at least "..vipDays.." premium days to buy this item.")
           doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
   return true
end
 
Back
Top Bottom