• 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 !aol and !backpack

Make a check if he's not PZ-locked and it'd be nice. Right now, it's useless and abusive only.

Don't replace NPCs with actions! Replace actions with NPCs!
Change gold thingy... grrr I hate it tho >.>

Also, tab your scripts correctly, it looks horrible o_O

PHP:
items = {
	["!backpack"] = {1988, 1, 100},
	["!aol"] = {2173, 1, 10000},
}

function onSay(cid, words, param)
	item = items[words]
	if (item ~= nil) then
		if doPlayerRemoveMoney(cid, item[3]) == 1 then
			doPlayerAddItem(cid, item[1], item[2])
		else
			doPlayerSendCancel(cid, 'You don\'t have enough money.')
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			return 0
		end
		return 1
	end
	return 0
end

Call it buy.lua and redirect !backpack and !aol to buy.lua, easy to add more items, just add a new line in the array, change !backpack to the word and itemid etc :)
 
Last edited:
Make a check if he's not PZ-locked and it'd be nice. Right now, it's useless and abusive only.

Don't replace NPCs with actions! Replace actions with NPCs!
Change gold thingy... grrr I hate it tho >.>

Also, tab your scripts correctly, it looks horrible o_O

PHP:
items = {
	["!backpack"] = {1988, 1, 100},
	["!aol"] = {2173, 1, 10000},
}

function onSay(cid, words, param)
	item = items[words]
	if (item ~= nil) then
		if doPlayerRemoveMoney(cid, item[3]) == 1 then
			doPlayerAddItem(cid, item[1], item[2])
		else
			doPlayerSendCancel(cid, 'You don\'t have enough money.')
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			return 0
		end
		return 1
	end
	return 0
end

Call it buy.lua and redirect !backpack and !aol to buy.lua, easy to add more items, just add a new line in the array, change !backpack to the word and itemid etc :)

thnx and I know this script is a bit outdated, but I don't have time for it anymore actually :p
 
just what i was looking for, thanks now i have a working base
 
First open up talkactions.xml in data/talkactions and add
Code:
	<talkaction words="!backpack" script="backpack.lua" />
	<talkaction words="!aol" script="aol.lua" />
in it.

then goto data/talkactions/scripts/

Create 2 new files 1 called backpack.lua and 1 called aol.lua.

place this in backpack.lua:
Code:
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 100) == 1 then
doPlayerAddItem(cid, 1988, 1)
else
			doPlayerSendCancel(cid, 'You don\'t have enough money.')
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		end
		end
doPlayerRemoveMoney(cid, 100) change 100 to the price u want.( I made it 100gp because you can buy it everywhere where u are.)

Ok now open aol.lua and place this in it:
Code:
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 10000) == 1 then
doPlayerAddItem(cid, 2173, 1)
else
			doPlayerSendCancel(cid, 'You don\'t have enough money.')
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		end
		end

doPlayerRemoveMoney(cid, 10000) again change this part to the price you want.

Can I add this with the magiceffect 27/28/29? If yes how? But it should be different not all effects at the same time^^
 
Needs tabbing. But good I guess anyway..

EDIT: Colandus: Nice script
 
Last edited:
!aol:
Code:
function onSay(cid, words, param)
local cost = 10000
local item = 2173
local quantity = 1
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddItem(cid, item, quantity)
else
doPlayerSendCancel(cid, "You have not enough gold.")
end
return TRUE
end

!backpack:
Code:
function onSay(cid, words, param)
local cost = 100
local item = 1988
local quantity = 1
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddItem(cid, item, quantity)
else
doPlayerSendCancel(cid, "You have not enough gold.")
end
return TRUE
end
 
!backpack
PHP:
function onSay(cid, words, param)
	if doPlayerRemoveMoney(cid, 100) == 1 then
		doPlayerAddItem(cid, 1988, 1)
		doPlayerSendCancel(cid, "You bought backpack.")
	else
		doPlayerSendCancel(cid, 'You don\'t have enough money.')
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
	return TRUE
end

!aol
PHP:
function onSay(cid, words, param)
	if doPlayerRemoveMoney(cid, 10000) == 1 then
		doPlayerAddItem(cid, 2173, 1)
		doPlayerSendCancel(cid, "You bought amulet of loss.")
	else
		doPlayerSendCancel(cid, 'You don\'t have enough money.')
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
	return TRUE
end
 
I actually thought that Master M made this thread today and i was very dissapointed.. But then i noticed it was posted 2 years ago so that is alright. lol
 
How ican Add <talkaction words="!backpack" script="backpack.lua" />
<talkaction words="!aol" script="aol.lua" />
in talkaction?? Please
 
Back
Top