SU

Comprar Items Do Shop Do Seu Ot Por Comando

Por Subwat, 20 de ago. de 2011 em Actions e Talkactions

script
4
2.3k
SubwatS
20 de agosto de 2011 às 13:02

esse sistema funciona da seguinte maneira,vocÊ digita !buyitem ele compra o item do shopping do seu ot por POINTS do shopping!

 

talkaction

 

function onSay(cid,words,param)
	special sword if (param == 'special sword') then
	local config = {itemid = 8932,cost = 20,name = 'a special Sword'}
	if CurrentPoints(getPlayerAccount(cid)) < config.cost then
	doPlayerSendCancel(cid, "Sorry, You need " .. config.cost .. " points to buy " .. config.name .. ".")
	elseif doRemovePremiumPoints(getPlayerAccount(cid), config.cost) == true then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_GREEN,"You have bought " .. config.name .. ".")
	doPlayerAddItem(cid, config.itemid, 1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	else
	doPlayerSendCancel(cid, "Sorry, You need " .. config.cost .. " points to buy " .. config.name .. ".")
end
	return true
end
end special sword
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_RED,'parametro incorreto.')
end		
return true
end

 

 

TAG:

<talkaction words="!buyitem" event="script" value="buy.lua" />

 

vai em LIB no arquivo 050-function cole isto no final:

 

 

function doRemovePremiumPoints(accountName, points)
points = tostring(points)
       return db.executeQuery('UPDATE `accounts` SET `premium_points` = `premium_points` -' .. points .. ' WHERE `name` = ' .. db.escapeString(accountName) .. ' LIMIT 1;')
end

function CurrentPoints(accountName)
playerpoints = db.getResult('SELECT `premium_points` FROM `accounts` WHERE `name` = ' .. db.escapeString(accountName) .. ' LIMIT 1;')
return playerpoints:getDataInt("premium_points")
end

function doPlayerGiveItem(cid, itemid, amount, subType)
local item = 0 if(isItemStackable(itemid)) then
item = doCreateItemEx(itemid, amount)
if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
	return false
end
else
for i = 1, amount do
item = doCreateItemEx(itemid, subType)

 

 

 

 

PRONTO.

 

créditos:

Subwat

Daniel Devotti

Editado Agosto 20 por Subwat

devotti2D
20 de agosto de 2011 às 13:04

Muito bom.

Ainda bem que colocou meus creditos né kkkkk

comentem ae galera e de REP +

YondaimeBRGY
21 de agosto de 2011 às 12:34

Very Good!

SubwatS
21 de agosto de 2011 às 12:55

é eu sei que é very good,sou o melhor scripter do brasil nao ti contaram?

kkkk