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

TalkAction Shop System Gesior talkaction tfs 1.x

Sir Islam

Never Give Up
Joined
Jun 6, 2008
Messages
504
Solutions
1
Reaction score
116
Location
Suez , Egypt
have fun :D i just Conversion it to work with 1.x
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:

just test it and u will know it work or no :p then if u see this not good can you tell us right script ? lol # WibbenZ


i know how to tab iam not new here to give me a learn :p and i will not tab it i will let it with out tab for you :) or you can take this photo if u want this script with tab lol :D #Bogart
11791081_10207150102018968_919372451_o.jpg
 
Last edited by a moderator:
just test it and u will know it work or no :p then if u see this not good can you tell us right script ? lol

You should update it to meta, why use the legacy functions?

i know how to tab iam not new here to give me a learn :p and i will not tab it i will let it with out tab for you :) or you can take this photo if u want this script with tab lol :D #Bogart
11791081_10207150102018968_919372451_o.jpg

And that is still not correct. Use the link he posted.
 
You should update it to meta, why use the legacy functions?
legacy functions work or no ? ha ? if yes work so why you Reply
And that is still not correct. Use the link he posted.
about tab i forget to tab it i just want to help ppl not to make beautiful script


any one don't like my scripts so no reply in my threads :D
 
legacy functions work or no ? ha ? if yes work so why you Reply

about tab i forget to tab it i just want to help ppl not to make beautiful script


any one don't like my scripts so no reply in my threads :D

Depends on if you use the compat.lua file, as most don't.
Main reason is that in a simple script you might have to recompile the userdata value, let's say 20 times - compared to one.

Then just skip it, things like this make me go crazy...
If you don't wanna do it correctly - don't do it.

What? Try another translator..
 
@God Mythera
Try it Talkactions :p

Code:
-- Znote Shop v1.0 for Znote AAC on TFS 1.0+.
function onSay(cid, words, param)
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
local cooldown = 15 -- in seconds.
local player = Player(cid)
if player:getStorageValue(storage) <= os.time() then
player:setStorageValue(storage, os.time() + cooldown)
-- Create the query
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. player:getAccountId() .. " LIMIT 1;")
-- Detect if we got any results
if orderQuery ~= false then
-- Fetch order values
local q_id = result.getDataInt(orderQuery, "id")
local q_type = result.getDataInt(orderQuery, "type")
local q_itemid = result.getDataInt(orderQuery, "itemid")
local q_count = result.getDataInt(orderQuery, "count")
result.free(orderQuery)
-- ORDER TYPE 1 (Regular item shop products)
if q_type == 1 then
-- Get wheight
if player:getFreeCapacity() >= ItemType(q_itemid):getWeight(q_count) then
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
player:addItem(q_itemid, q_count)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received " .. q_count .. " x " .. ItemType(q_itemid):getName() .. "!")
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "Need more CAP!")
end
end
-- Add custom order types here
-- Type 2 is reserved for premium days and is handled on website, not needed here.
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
-- So use type 4+ for custom stuff, like etc packages.
-- if q_type == 4 then
-- end
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have no orders.")
end
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
end
return false
end
 
Back
Top