• 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!

TalkAction buy blessing

soul4soul

Intermediate OT User
Joined
Aug 13, 2007
Messages
1,875
Solutions
3
Reaction score
128
Location
USA
well i based it from master-m's buy items talkaction script which can be found here

i made it cost 20k instead of 10k. so here we go

Code:
local items = {
	["first bless"] = { price = 15000, bless = 1 },
	["second bless"] = { price = 15000, bless = 2 },
	["third bless"] = { price = 15000, bless = 3 },
	["fourth bless"] = { price = 15000, bless = 4 },
	["fifth bless"] = { price = 15000, bless = 5 }
	}

function onSay(cid, words, param)
	local item = items[param]
	local basemoney = 5000
	if item then
		if doPlayerRemoveMoney(cid, basemoney) == TRUE then
			if getPlayerBlessing(cid, item.bless) then
				doPlayerSendTextMessage(cid, 24, "You already have that blessing, Alice's spirit took " ..basemoney.. " gold from you for wasting her time.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, item.price) == TRUE then
					doPlayerSendTextMessage(cid, 24, "Alice has sent her spirit to give you your "..item.."ing for "..item.price.." gold coins.")
					doPlayerAddBlessing(cid, item.bless)
				else
					doPlayerSendTextMessage(cid, 24, "You need  "..item.."ing for "..item.price.." gold coins.")
				end
			else
				doPlayerSendTextMessage(cid, 24, "Alice's spirit reminds you, that you need premium to buy blessing. Her spirit stole "..basemoney.." from you.")
			end
		else
			doPlayerSendTextMessage(cid, 24, "You need at least "..basemoney.." gold to contact alice's intrests and another "..item.price.." gold to buy a blessing.")
		end
	else			
			-- Sends the player a message wich includes items he can buy --
			doPlayerSendTextMessage ( cid, 24, 'You can buy the following items:' )
			
			-- Getting all the itemnames --
			for item1 in pairs (items) do
								
				-- Sends a message with each itemname and price --
				doPlayerSendTextMessage ( cid, 24, item1 )
				
			-- Ends the for function--
			end

		-- ends the itemname check --
		end
	return TRUE
end

and

Code:
<talkaction words="!bless" script="bless.lua"/>

to use it say !bless "first bless


some note: the script checks if the player has 5k first. then to see if he already has that blessing and if he is premium. if the player fails either of these checks he loses the 5k for wasting the spirits time. if he pass all the checks then he lose another 15k to buy the blessing. SO in total the blessing costs 20k
 
Last edited:
Nice done ;) But one thing that I shall improve if I was you is that if they only say !bless that he gives a list of options to say ;)
 
thanks, and i changed it like u said.

Code:
doPlayerSendTextMessage(cid, 24, "You can only buy blessing. Try saying !bless \"first bless, this works all the way up to fifth bless.")

that was the best way i could come up with to explain it to ppl who used it incorrectly
 
well i based it from master-m's buy items talkaction script which can be found here

i made it cost 20k instead of 10k. so here we go

Code:
[B]	else
		doPlayerSendTextMessage(cid, 24, "You can only buy blessing. Try saying !bless \"first bless, this works all the way up to fifth bless.")
	end[/B]
	return TRUE
end

change bolt part to

Code:
	else			
			-- Sends the player a message wich includes items he can buy --
			doPlayerSendTextMessage ( cid, 24, 'You can buy the following items:' )
			
			-- Getting all the itemnames --
			for item1 in pairs (items) do
								
				-- Sends a message with each itemname and price --
				doPlayerSendTextMessage ( cid, 24, item1 )
				
			-- Ends the for function--
			end

		-- ends the itemname check --
		end

That is what i use, Edit some small things to fit it by u ;D
 
okay thanks updated

now if u say !bless or !bless "any words or thing not in the list

it will give u a list of what u can buy so ex.

Player:!bless
returned:you may buy:
returned:first bless
returned:second bless
returned:third bless
returned:fourth bless
returned:fifth bless
 
Back
Top