drullen
New Member
Hello when players die they dont lose aol
please help!
please help!
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddItem(cid, 2173, 1)
doPlayerSendTextMessade(cid, MESSAGE_INFO_DESCR, "You have bought an amulet of loss for 1 cc!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
else
doPlayerSendCancel(cid, "Sorry, You need 1 cc to buy a aol.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return true
end
<talkaction words="!aol" event="script" value="aol.lua"/>
<?xml version="1.0" encoding="UTF-8"?>
<mod name="command-buy" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
<config name="command-buy-config"><![CDATA[
items = {
['aol'] = {cost = 30000, id = 2173},
}
]]></config>
<talkaction words="!buy" event="script"><![CDATA[
domodlib('command-buy-config')
local config = {
items = items
}
function onSay(cid, words, param, channel)
if(param == '') then
local str = ""
for name, options in pairs(config.items) do
str = str .. "\n" .. name
end
doPlayerPopupFYI(cid, "!buy\n\n:" .. str)
return true
end
local item = config.items[param]
if(item ~= nil) then
if(not doPlayerRemoveMoney(cid, item.cost)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Not enough money to buy " .. param .. ".\n(" .. item.cost .. "gp)")
return true
end
local amount = item.amount and item.amount or 1
doPlayerAddItem(cid, item.id, amount)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
else
doPlayerSendCancel(cid, "Item not found. Use '!buy' to see the list.")
end
return true
end
]]></talkaction>
</mod>