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

My first talkaction script

apa123

New Member
Joined
Jun 24, 2008
Messages
40
Reaction score
0
Today ive finally made my first script that works :) Thanks to some tutorials.
Its an talkaction script :)

PHP:
	<talkaction words="!backpack" script="backpack.lua" />

PHP:
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
 
Learn to tab :p

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

By the way, some people would like to use this script for something else than a backpack. You could make a variable to make it easier for them to change it. What I mean:

Code:
local item = 1988 -- Here is the ID of the item.

function onSay(cid, words, param)
   if doPlayerRemoveMoney(cid, 100) == 1 then
      doPlayerAddItem(cid, item, 1) -- You see instead of the ID, the variable, because it needs to redirect to the variable 'item' with the ID of the backpack.
   else
      doPlayerSendCancel(cid, 'You don\'t have enough money.')
      doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
   end
end
 
function onSay(cid, words, param)

I always wondered what this means.
Activate the function "OnSay"?
 
Back
Top