• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Talkactions & paramters

GH057

New Member
Joined
Oct 11, 2007
Messages
54
Reaction score
0
Location
Brazil
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.

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?
 
advice: don't declare constants inside your functions. >:/


and what does it output when you try to run the script? or does it just not work?
 
you say that it does not act like a talkaction.. hmm.. do you use :: !buypremium "semana :: or :: !buypremium semana :: ? if you use the 2nd then its because you need to add it in talkactions.xml since params is made by putting the " followed by the param
 
i use !buypremium semana (semana = week)
if i dont put any param, it just say the error message, but, if i put semana, it does not like as a command, acts like a message.

I will try to put the "
thx.
 

Similar threads

Back
Top