I did a modification in !buypremium talkaction, to choose the premium time using param...
but, when i try to use the param, it does not act like a talkaction.
Can someone help me?
but, when i try to use the param, it does not act like a talkaction.
Code:
function onSay(cid, words, param)
local priceweek = 10000
local pricemonth = 30000
local priceyear = 300000
local paramweek = "semana"
local parammonth = "mes"
local paramyear = "ano"
local msgweek = "Voce comprou 1 semana de premium"
local msgmonth = "Voce comprou 1 mes de premium"
local msgyear = "Voce comprou 1 ano de premium"
local msghelp = "Voce pode comprar premium de uma semana (10k), um mes (30k) ou um ano (300k)."
local msgnomoney = "Voce não tem dinheiro suficiente."
if getPlayerPremiumDays(cid) <= 350 then
if param == "semana" then
if doPlayerRemoveMoney(cid, priceweek) then
doPlayerAddPremiumDays(cid, 7)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgweek)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgnomoney)
end
elseif param == parammonth then
if doPlayerRemoveMoney(cid, pricemonth) then
doPlayerAddPremiumDays(cid, 30)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgmonth)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgnomoney)
end
elseif param == paramano then
if doPlayerRemoveMoney(cid, priceyear) then
doPlayerAddPremiumDays(cid, 90)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgyear)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msgnomoney)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msghelp)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "Voce nao pode comprar mais do que um ano de premium.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
Can someone help me?