Sir Islam
Never Give Up
have fun i just Conversion it to work with 1.x
add_shop_talkaction.lua
i wont tab this script i just want to help ppl not to make beautiful script if u like it with tab take it and tab
any one don't like my scripts don't reply in my threads
Code:
<talkaction words="/addshop" separator=" " script="add_shop_talkaction.lua"/>
add_shop_talkaction.lua
Code:
function onSay(cid, words, param, channel)
local params = param:split(",")
local price = params[1]
table.remove(params, 1)
local desc = table.concat(params,",")
local name = ''
local item1 = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
local itemid1 = item1.itemid
local count1 = item1.type
local itemid2 = 0
local count2 = 0
if(itemid1 == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Put item in right hand.")
return true
end
if(not price) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must set price.")
return true
end
price = tonumber(price)
local offer_type = 'item'
if(isContainer(item1.uid)) then
local item2 = getContainerItem(item1.uid, 0)
if(item2.itemid > 0) then
count1 = getContainerCap(item1.uid)
itemid2 = item2.itemid
count2 = item2.type
offer_type = 'container'
end
end
local count1_desc = (count1 > 0) and count1 or 1
local count2_desc = (count2 > 0) and count2 or 1
if(itemid2 == 0) then
name = count1_desc .. 'x ' .. getItemName(itemid1)
else
name = count1_desc .. 'x ' .. count2_desc .. 'x ' .. getItemName(itemid2)
end
db.query('INSERT INTO `z_shop_offer` (`id` ,`points` ,`itemid1` ,`count1` ,`itemid2` ,`count2` ,`offer_type` ,`offer_description` ,`offer_name`) VALUES (NULL , ' .. price .. ', ' .. itemid1 .. ', ' .. count1 .. ', ' .. itemid2 .. ', ' .. count2 .. ', \'' .. offer_type .. '\', ' .. db.escapeString(desc) .. ', ' .. db.escapeString(name) .. ');')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item >> " .. name .. " << added to SMS shop. Price is " .. price .. " premium points.")
return true
end
i wont tab this script i just want to help ppl not to make beautiful script if u like it with tab take it and tab
any one don't like my scripts don't reply in my threads
Last edited: