• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Comand !buyaol

ushoriuma

OTNET Monkey
Joined
Apr 9, 2009
Messages
4
Reaction score
0
author:--Ushoriuma--
version:all versions (I think)
type of script:TalkActions

Hello
For you I'll Post My Script to buy aol for talkactions.

First open the folder data/talkactions/scripts, copy any file and rename it buyaol, delete what is in and add this:

Code:
-- By Ushoriuma --
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 10000) == TRUE then
doPlayerGiveItem(cid, 2173, 1, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought one aol for 10000 gold coins.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
else
doPlayerSendCancel(cid, "You need 10000 gold coins to buy aol.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 10000 gold coins to buy aol.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGY)
end
end

After going on data/talkactions and open the folder talkactions.xml and add the following tag on it:

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

Ready now just the player talk !buyaol and he buys one aol for 10k(10000 gold coins).
xD
Thank you!
 
This is a better one.
PHP:
function onSay(cid, words, param)

local config =
{ 
cost = 1000, 
item = 2173 
}


if doPlayerRemoveMoney(cid, cost) == TRUE then
	doPlayerAddItem(cid, item, 1)
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You bought 1 amulet of loss for "..cost..".")
	else
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You dont have enough money")
     end
end
 
This is a better one.
PHP:
function onSay(cid, words, param)

local config =
{ 
cost = 1000, 
item = 2173 
}


if doPlayerRemoveMoney(cid, cost) == TRUE then
	doPlayerAddItem(cid, item, 1)
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You bought 1 amulet of loss for "..cost..".")
	else
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You dont have enough money")
     end
end

The mine is better that is less complicated!
 
Many people say that the more complicated the script it better, but as you can see mine is simpler than the Zonet and has the same function!
xD
Thanks for posting all questions I answer!
=P
 
This is a better one.
PHP:
function onSay(cid, words, param)

local config =
{ 
cost = 1000, 
item = 2173 
}


if doPlayerRemoveMoney(cid, cost) == TRUE then
	doPlayerAddItem(cid, item, 1)
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You bought 1 amulet of loss for "..cost..".")
	else
	doPlayerSendTextMessage(cid, MESSAGE_DESCR_INFO, "You dont have enough money")
     end
end

Get config outside of the function so it wont be loaded everytime the script is fired.

Code:
local config = {
	price = 10000,
	itemId = 2173
}

function onSay(cid, words, param)
	local count = 1
	if isNumber(param) == TRUE and param < 21 then
		count = param
	end
	
	if doPlayerRemoveMoney(cid, config.price * count) == TRUE then
		for i = 1, count do
			doPlayerAddItem(cid, config.itemId, 1)
		end
	else
		doPlayerSendCancel(cid, "You need "..count * config.price.." gold to buy "..count.." AoL(s).")
	end
	
	return TRUE
end
 
Back
Top