5mok3
Emporia
I'm not a pro coder so.. I've been struggling for a while trying to fix this piece of code <_<
What it does.. or it's supposed to do
When you say !buy name the script runs.. and you buy one of the offers available on the list
The script is not a 100% and it's not working.. its just a piece of code i never finished
Hopefully someone will help me finish it! :wub:
I'll rep your asses off if you do jaja
What it does.. or it's supposed to do
When you say !buy name the script runs.. and you buy one of the offers available on the list
The script is not a 100% and it's not working.. its just a piece of code i never finished
LUA:
-- Emporia.vapus.net --
----------------------------
-- Author: 5moke --
-- Emporia VAPus --
----------------------------
local shop =
{
-- ["Offer name"] = {id = ITEM_ID, cost = POINTS_COST, charges = ITEM_COUNT, effect = DISPLAY_EFFECT} --
["crystal coins"] = {id = 2160, cost = 5, charges = 50, effect = CONST_ME_GIFT_WRAPS}
}
function onSay(cid, words, param, channel)
local v = shop[item.name]
local weight = getItemWeightById(v.id, tonumber(getItemInfo(v.container).maxItems)) + getItemWeightById(v.container, 1)
if(getPlayerFreeCap(cid) >= weight) then
if(getAccountPoints(cid) >= v.cost) then
if(doPlayerAddItemEx(cid, v.id, v.charges) ~= RETURNVALUE_NOERROR) then
doPlayerSendCancel(cid, "Sorry, you do not have enough space.")
else
doPlayerAddItem(cid, v.id, v.charges)
end
doRemovePoints(cid, v.cost)
doSendMagicEffect(getThingPos(cid), v.effect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have purchased: " .. getItemInfo(v.id).plural .. ".")
end
else
doPlayerSendCancel(cid, "Sorry, you must have " .. v.cost .. " points.")
end
else
doPlayerSendCancel(cid, "Sorry, you need " .. weight:format("%.2f") .. " oz. to carry this item: " .. getItemInfo(v.id).plural .. ".")
end
return TRUE
end
-- Emporia.vapus.net --
Hopefully someone will help me finish it! :wub:
I'll rep your asses off if you do jaja