Mabako's hint script:
--[[
Copyright (c) 2010 MTA: Paradise
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
]]
local screenX, screenY = guiGetScreenSize( )
local cursorX, cursorY = -1, -1
local defaultWidth = 360
local width = defaultWidth
local height = 70
local x = ( screenX - width ) / 2
local y = screenY - height - 60
local line_height = 16
--
local title, text, icon, color, start, duration
--
addEventHandler( "onClientRender", root,
function( )
if start and duration then
local tick = getTickCount( )
if tick > start + duration then
title = nil
text = nil
icon = nil
color = nil
start = nil
duration = nil
else
local alpha = 1
if start + duration / 2 < tick then
alpha = ( start + duration - tick ) / duration * 2
end
dxDrawRectangle( x - 5, y - 5, width + 10, height + 10, tocolor( color[1], color[2], color[3], color[4] * alpha ), true )
dxDrawImage( x, y + ( height - 64 ) / 2, 64, 64, "images/" .. icon .. ".png", 0, 0, 0, tocolor( 255, 255, 255, 255 * alpha ), true )
dxDrawText( title, x + 65, y, x + width, y + 18, tocolor( 255, 255, 255, 255 * alpha ), 0.6, "bankgothic", "left", "top", true, false, true )
dxDrawText( text, x + 70, y + 18, x + width, y + height, tocolor( 255, 255, 255, 255 * alpha ), 1, "default", "left", "top", true, true, true )
end
end
end
)
--
function hint( ti, te, ic, dur )
if ic == 1 then
icon = "okay"
color = { 0, 93, 0, 193 }
elseif ic == 2 then
icon = "warning"
color = { 127, 97, 31, 193 }
elseif ic == 3 then
icon = "error"
color = { 127, 31, 31, 193 }
else
icon = "info"
color = { 31, 127, 127, 193 }
end
start = getTickCount( )
if type( dur ) ~= "number" or dur < 500 then
duration = 10000
else
duration = dur
end
title = ti
text = te
return true
end
addEvent( "gui:hint", true )
addEventHandler( "gui:hint", getLocalPlayer( ), hint )
"Your" script:
local screenX, screenY = guiGetScreenSize( )
local cursorX, cursorY = -1, -1
local defaultWidth = 230
local width = defaultWidth
local height = 150
local x = ( screenX - width )
local y = screenY - height - 60
local line_height = 16
--
local title, text, icon, color, start, duration,tcolor
--
addEventHandler( "onClientRender", root,
function(player)
if start and duration then
local tick = getTickCount( )
if tick > start + duration then
title = nil
text = nil
icon = nil
color = nil
start = nil
duration = nil
tcolor = nil
else
local alpha = 1
if start + duration / 2 < tick then
alpha = ( start + duration - tick ) / duration * 2
end
dxDrawRectangle( x , 0, width + 20, height + 2, tocolor( color[1], color[2], color[3], color[4] ), true )
dxDrawText( title, x, 0, x + width, y + 18, tocolor( 255, 255, 255, 255), 0.5, "bankgothic", "left", "top", true, false, true )
dxDrawText( text, x +2 ,25, x + width, y + height, tocolor( tcolor[1], tcolor[2], tcolor[3], tcolor[4] ), 0.6, "bankgothic", "left", "top", true, true, true )
end
end
end
)
--
function logo( ti, te, ic, dur )
if ic == 1 then
icon = "okay"
color = { 0, 0,0, 255 }
tcolor = {204,204,0,255}
--playSoundFrontEnd(12,source)
elseif ic == 2 then
icon = "warning"
color = {0, 0, 0, 255 }
tcolor = {255,204,0,255}
--playSoundFrontEnd(12,source)
elseif ic == 3 then
icon = "error"
color = { 0, 0, 0, 255 }
tcolor = {255,0,0,255}
--playSoundFrontEnd(11,source)
else
icon = "info"
color = { 0, 0, 0,255 }
tcolor = {255,255,0,255}
playSoundFrontEnd(12,source)
end
start = getTickCount( )
if type( dur ) ~= "number" or dur < 500 then
duration = 4000
else
duration = dur
end
title = ti
text = te
return true
end
addEvent( "aoutput",true )
addEventHandler( "aoutput", getLocalPlayer( ), logo )
-- Usage
-- triggerEvent("aoutput",getLocalPlayer(),"Msg","Hello World")