Mateus Robeerto
Excellent OT User
Hello Otland community, I managed to put a "storage" to buy clothes and deliver to the player, working ok... However, it only delivers one. I can't place another storage to deliver another outfit, without success... Can someone help me, please?
follow the video:
I chose the 'Nordic Chieftain' outfit, but he gave away the 'Formal Dress'. I tried to put several different functions in without success... I need to finish this store soon, for God's sake.
in creaturescript.. game_store.lua.
this part to buy.
follow the video:
I chose the 'Nordic Chieftain' outfit, but he gave away the 'Formal Dress'. I tried to put several different functions in without success... I need to finish this store soon, for God's sake.
in creaturescript.. game_store.lua.
LUA:
local category3 = addCategory({
type = "outfit",
name = " News Outfits ",
outfit = {
type = 128, -- This type is for displaying an image for the store.
rotating = false
}
})
-- for the player to choose the outfit and buy!
category3.addOutfit(9, {
storage = 535923,
type = 1500,
rotating = true
}, "Nordic Chieftain", "esta e a sua nova roupa legal. Voce pode compra-lo aqui")
category3.addOutfit(9, {
storage = 535924,
type = 1489,
rotating = true
}, "Ghost Blade", "esta e a sua nova roupa legal. Voce pode compra-lo aqui")
category3.addOutfit(9, {
storage = 535925,
type = 1460,
rotating = true
}, "Formal Dress", "esta e a sua nova roupa legal. Voce pode compra-lo aqui")
this part to buy.
LUA:
function defaultItemBuyAction(player, offer)
if player:addItem(offer["itemId"], offer["count"], false) then
return true
end
return "Unable to add item! you have enough space?"
end
local config = {
-- Nordic Chieftain
storage = 535923,
looktype = 1500,
-- Ghost Blade
storage = 535924,
looktype = 1489,
-- Formal Dress
storage = 535925,
looktype = 1460
}
function defaultOutfitBuyAction(player, offer)
local outfit = offer['outfit']
if player:getStorageValue(config.storage) < 1 then
player:addOutfit(config.looktype)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You already own this outfit!")
return false
end
local points = getPoints(player)
if offer['cost'] > points or points < 1 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You don't have enough points to buy this outfit")
return false
end
-- Remover pontos do jogador
db.query("UPDATE `znote_accounts` SET `points` = `points` - " .. offer['cost'] .. " WHERE `id` = " .. player:getAccountId())
player:setStorageValue(config.storage, 1)
player:addOutfit(outfit)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations, you bought an outfit")
db.asyncQuery("INSERT INTO `shop_history` (`account`, `player`, `date`, `title`, `cost`, `details`) VALUES ('" .. player:getAccountId() .. "', '" .. player:getGuid() .. "', NOW(), " .. db.escapeString(offer['title']) .. ", " .. db.escapeString(offer['cost']) .. ", " .. db.escapeString(json.encode(offer)) .. ")")
local outfitName = outfit.name or "Unknown Outfit"
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully purchased the outfit '" .. outfitName .. "'.")
return true
end