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

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
This is a script that you can do it.
Code:
22:55 Mock: hi
22:55 Zarox: i am fag
22:55 Mock: QUOTED MWHAHAHAHA!!!
And when some players say !quote they will se all this shames
razzberry.gif


Well it works on MYSQL! if you want it run on sqlite you have to create the row by yourself.

If you use mysql just say it once:
!addquote sql and it run the query.

To add a quote:
!addquote 22:55 Zarox: i am fag
To delete a quote:
!addquote delete ID
To see quote list/id
!quote
To see a quote
!quote ID
sdsda.png

Well ad this 2 tags on talkactions.xml:
Code:
<talkaction words="!quote" event="script" value="quote.lua"/>
<talkaction log="yes" words="!addquote" access="2" event="script" value="quote.lua"/>

Now on quote.lua add it:
Lua:
--Quote system by mock the bear (MTB)
function getQuoteN()
	local result = db.getResult("SELECT * FROM quote ORDER BY `time` DESC")
	local n = 0
	repeat
		n = n+1
	until not result:next()
	result:free()
	return n
end --- Script By mock!
function checkQuote(n)
	local result = db.getResult("SELECT * FROM quote WHERE `id`="..n)
	if(result:getID() ~= -1) then
		result:free()
		return true
	else
		return false
	end
end
function onSay(cid, words, param, channel) --Quote system by mock the bear (MTB)
	if words == '!quote' and not tonumber(param) then
		local result = db.getResult("SELECT * FROM quote")
		local s = 'Quote list\n--------------\n'
		if(result:getID() ~= -1) then
			repeat
				s = s..'['..result:getDataInt("id")..'] - By: '..result:getDataString("player")..' at '..os.date("%d %B %Y %X ", result:getDataInt("time"))..'\n'
			until not result:next()
			result:free()
		end
		doShowTextDialog(cid,1953,s..'\n--------------\nSay !quote 1 to see the first quote.')
	elseif tonumber(param) then
		local result = db.getResult("SELECT * FROM quote WHERE `id`="..tonumber(param))
		if(result:getID() ~= -1) then
			doShowTextDialog(cid,1953,'Quote id '..tonumber(param)..'\nBY: '..result:getDataString("player")..'\nAt:'..os.date("%d %B %Y %X ", result:getDataInt("time"))..'\n-----------\n'..result:getDataString("quoted"))
		else
			doPlayerSendTextMessage(cid,25,'Ivalid quote id. Please see the list!')
		end
	elseif param ~= '' and words == '!addquote' then
		if param == 'sql' then
			db.executeQuery([[CREATE TABLE `quote` (
			`id` INT NOT NULL AUTO_INCREMENT ,
			`player` VARCHAR( 50 ) NOT NULL ,
			`time` INT( 20 ) NOT NULL ,
			`quoted` TEXT NOT NULL ,
			PRIMARY KEY ( `id` ) ,
			INDEX ( `id` )
			) ENGINE = MYISAM ;]])
		elseif param:match('delete%s*(%d+)') then
			local n = param:match('delete%s*(%d+)')
			if checkQuote(n) then
				db.executeQuery([[DELETE FROM `quote` WHERE `quote`.`id` = ]]..n)
				if checkQuote(n) then
					doPlayerSendTextMessage(cid,25,'Cannot delete this quote.')
				else
					doPlayerSendTextMessage(cid,25,'Quote deleted.')
				end
			else
				doPlayerSendTextMessage(cid,25,'Invalid quote id.')
			end
		else
			db.executeQuery(string.format([[INSERT INTO `quote` (
			`id` ,
			`player` ,
			`time` ,
			`quoted`
			)
			VALUES (
			NULL , '%s', '%d', '%s'
			);]],getCreatureName(cid),os.time(),param))
			doPlayerSendTextMessage(cid,25,'Quote add nº'..getQuoteN()..'!')
			doSendMagicEffect(getCreaturePosition(cid),30)
		end
	end
	return true
end
And enjoy
grin.gif
 
Hey Mock,
Nice Nice...
IRCBot remembered now.

Very good script, a script idea for a future, a mail system.
 
edit > ok ok, im second , HAHAHAHAHAHHAA
Santa criatividade......

- - - -
hahahahah nice criativity xD

Mas nao entendi
Vc poce quotar qlqr coisa?!?!
Inclusive fake quots X_X ?
 
Da até pra usar isso como sistema de noticias :p !!!!!!!!
Só por acesso nas talkactions!
 
How i can set for wich this quote only can used in true messages?
 
Back
Top