Todo ot apelado ou global precisa desse comando, mas o meu eh um pouco melhor T.T
Em talkactions/scripts:
local config = {
level = 10, -- level minimo
price = 10000, -- preço unidade
effect = CONST_ME_POFF, -- efeito ao comprar aol
id = 2173 -- id do item comprado (aol no caso)
}
function onSay(cid, words, param)
if param == "" and doPlayerRemoveMoney(cid,config.price)and getPlayerLevel(cid) >= config.level then
doPlayerAddItem(cid, config.id)
doSendMagicEffect(getThingPos(cid), config.effect)
elseif not isNumeric(param) or tonumber(param) < 0 then
doPlayerSendCancel(cid, "Command positive numeric param is required.")
else
local config2 = {
error = "You do not have enought level "..config.level.." or money ("..config.price*param.."gps)",
msg = "You bought "..param.." amulet of loss, it costs "..(tonumber(param)*config.price).."gps."
}
if getPlayerLevel(cid) >= config.level and doPlayerRemoveMoney(cid, config.price*tonumber(param)) then
doSendMagicEffect(getThingPos(cid), config.effect)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config2.msg)
for i = 1,param do
doPlayerAddItem(cid, config.id, 1)
end
else
doPlayerSendCancel(cid, config2.error)
end
end
return true
end[/PHP]
Talkactions.xml:
[PHP]<talkaction words="!aol;/aol" event="script" value="aol.lua"/>
Obs: Esse script nao eh do lá aquelas coisas mas me ensinou algumas coisas (:
Obs2: Faz um tempo legal que fiz esse script.