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

timiodimio

New Member
Joined
May 6, 2009
Messages
16
Reaction score
0
Easy to configure script to buy items with an !talkaction.

This one in talkactions/scripts

PHP:
local itemid = 5710   <!-- light shovel --> 
local count = 1
local succestalk = "You\'ve bought an light shovel."
local fail = "You don't have enough money."


function onSay (cid, words, param)
       if doPlayerRemoveMoney(cid, cost) == TRUE  then
	      doPlayerAddItem(cid, itemid, count)
		  doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, succestalk)
		  doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)

		else doPlayerSendCancel(cid, MESSAGE_EVENT_ADVANCE,talkcap)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
end

Put this in talkactions.xml:

HTML:
<talkaction words="!shovel" event="script" value="file.lua"/>

Ciao!
 
Back
Top