mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-14 10:14:55 +02:00
Fix #369 - Outfit offer type (5) supports 2 outfit ids.
This commit is contained in:
@@ -35,24 +35,37 @@ function onSay(cid, words, param)
|
||||
-- Get wheight
|
||||
local playerCap = getPlayerFreeCap(cid)
|
||||
local itemweight = getItemWeight(q_itemid, q_count)
|
||||
if playerCap >= itemweight then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddItem(cid, q_itemid, q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||
end
|
||||
if playerCap >= itemweight then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddItem(cid, q_itemid, q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||
end
|
||||
end
|
||||
-- ORDER TYPE 5 (Outfit and addon)
|
||||
if q_type == 5 then
|
||||
served = true
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
|
||||
local itemid = q_itemid
|
||||
local outfits = {}
|
||||
|
||||
if itemid > 1000 then
|
||||
local first = math.floor(itemid/1000)
|
||||
table.insert(outfits, first)
|
||||
itemid = itemid - (first * 1000)
|
||||
end
|
||||
table.insert(outfits, itemid)
|
||||
|
||||
for _, outfitId in pairs(outfits) do
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -48,14 +48,27 @@ function onSay(cid, words, param)
|
||||
-- ORDER TYPE 5 (Outfit and addon)
|
||||
if q_type == 5 then
|
||||
served = true
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
||||
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
result.free(delete)
|
||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
|
||||
local itemid = q_itemid
|
||||
local outfits = {}
|
||||
|
||||
if itemid > 1000 then
|
||||
local first = math.floor(itemid/1000)
|
||||
table.insert(outfits, first)
|
||||
itemid = itemid - (first * 1000)
|
||||
end
|
||||
table.insert(outfits, itemid)
|
||||
|
||||
for _, outfitId in pairs(outfits) do
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
result.free(delete)
|
||||
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -58,13 +58,26 @@ function onSay(cid, words, param)
|
||||
-- ORDER TYPE 5 (Outfit and addon)
|
||||
if q_type == 5 then
|
||||
served = true
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
||||
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
|
||||
local itemid = q_itemid
|
||||
local outfits = {}
|
||||
|
||||
if itemid > 1000 then
|
||||
local first = math.floor(itemid/1000)
|
||||
table.insert(outfits, first)
|
||||
itemid = itemid - (first * 1000)
|
||||
end
|
||||
table.insert(outfits, itemid)
|
||||
|
||||
for _, outfitId in pairs(outfits) do
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -65,16 +65,29 @@ function onThink(interval, lastExecution)
|
||||
-- ORDER TYPE 5 (Outfit and addon)
|
||||
if orderType == 5 then
|
||||
served = true
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not player:hasOutfit(orderItemId, orderCount) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
|
||||
player:addOutfit(orderItemId)
|
||||
player:addOutfitAddon(orderItemId, orderCount)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
print("Process complete. [".. player:getName() .."] has recieved outfit: ["..orderItemId.."] with addon: ["..orderCount.."]")
|
||||
else -- Already has outfit
|
||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
print("Process canceled. [".. player:getName() .."] already have outfit: ["..orderItemId.."] with addon: ["..orderCount.."].")
|
||||
|
||||
local itemid = orderItemId
|
||||
local outfits = {}
|
||||
|
||||
if itemid > 1000 then
|
||||
local first = math.floor(itemid/1000)
|
||||
table.insert(outfits, first)
|
||||
itemid = itemid - (first * 1000)
|
||||
end
|
||||
table.insert(outfits, itemid)
|
||||
|
||||
for _, outfitId in pairs(outfits) do
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not player:hasOutfit(outfitId, orderCount) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
|
||||
player:addOutfit(outfitId)
|
||||
player:addOutfitAddon(outfitId, orderCount)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
print("Process complete. [".. player:getName() .."] has recieved outfit: ["..outfitId.."] with addon: ["..orderCount.."]")
|
||||
else -- Already has outfit
|
||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
print("Process canceled. [".. player:getName() .."] already have outfit: ["..outfitId.."] with addon: ["..orderCount.."].")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -47,14 +47,27 @@ function onSay(player, words, param)
|
||||
-- ORDER TYPE 5 (Outfit and addon)
|
||||
if q_type == 5 then
|
||||
served = true
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not player:hasOutfit(q_itemid, q_count) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
player:addOutfit(q_itemid)
|
||||
player:addOutfitAddon(q_itemid, q_count)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
|
||||
local itemid = q_itemid
|
||||
local outfits = {}
|
||||
|
||||
if itemid > 1000 then
|
||||
local first = math.floor(itemid/1000)
|
||||
table.insert(outfits, first)
|
||||
itemid = itemid - (first * 1000)
|
||||
end
|
||||
table.insert(outfits, itemid)
|
||||
|
||||
for _, outfitId in pairs(outfits) do
|
||||
-- Make sure player don't already have this outfit and addon
|
||||
if not player:hasOutfit(outfitId, q_count) then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
player:addOutfit(outfitId)
|
||||
player:addOutfitAddon(outfitId, q_count)
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||
else
|
||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user