Jump to content

[REL]Top Chat Bar (Current Version: v1.4.1)


xXMADEXx

Recommended Posts

Information & Fetures:

Hi guys! Today i've made a top bar chat for the MTA community.

Please let me know what you think of this script, and rate it 5/5 on MTA community website! Community Link

The last message sent will have the darkest alpha, and every message lasts for 8 seconds. The maximum messages that it will show at a time is 5, and the lasting time + max messages are very easy to change. (can only be changed in the uncompiled code.)

Author: xXMADEXx

Version 1.4:

Changelog:

- Added messages fade in/out

- Replaced timers with getTickCount ( )

- Made it so the same messages can be showed more than once

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100, true, 8 ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100, false, 10 ) 
end ) 

Version 1.3:

Changelog:

- Added HEX color code support

- Added a optional time argument

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100, true, 8 ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100, false, 10 ) 
end ) 

Version 1.1 - Version 1.2:

Changelog:

(1.1)

- Fixed an error with the max messages (was always one more then defined)

- Added the bottom bar

- Added an argument to select what bar to output to

(1.2)

- Fixed a bug with the bar message operations (didn't output to the correct positions)

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255, bool topBar=true ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255, bool topBar=true ] ) 

  
[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100, true ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100, false ) 
end ) 

Version 1.0:

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255 ] ) 

  
[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100  ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100 ) 
end ) 

Edited by Guest
Link to comment
Really nice script but I want to move it to bottom like debugscript. Because I got race timers in there. Can I change cordinates with your permission?

Yea, you have my permission, no prob (If you want help i can help you.) Do whatever else you want to it too, just please don't remove my credits.

Link to comment
Really nice script but I want to move it to bottom like debugscript. Because I got race timers in there. Can I change cordinates with your permission?

Yea, you have my permission, no prob (If you want help i can help you.) Do whatever else you want to it too, just please don't remove my credits.

If you make the one with bottom too it would be good :) Or new argument for making message at bottom :)

Link to comment

Thank you

Really nice script but I want to move it to bottom like debugscript. Because I got race timers in there. Can I change cordinates with your permission?

Yea, you have my permission, no prob (If you want help i can help you.) Do whatever else you want to it too, just please don't remove my credits.

If you make the one with bottom too it would be good :) Or new argument for making message at bottom :)

I might be able to make a new argument to make it come out on the bottom... Ill try it

Edit:

This has been added.

Edited by Guest
Link to comment
Well done mate , this is really awesome script

keep going :)

Thank you!

New Version Released: v1.1

Whats added?

- Fixed a bug with the max messages

- Added a new bottom bar, with a new argument "topBar."

New format code:

Client:

bool sendClientMessage ( string text [, int r=0, int g=0, int b=0, bool topBar=true ] ) 

[b]Required Arguments[/b] 
Text - the text that will be outputed into the bar 
[b]Optional Arguments[/b] 
r - The amount of red you want in the mixture of RGB (0-255 is valid) 
g - The amount of green you want in the mixture of RGB (0-255 is valid) 
b - The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar - If true then the message will be sent to the top bar, if false the it will be sent to the bottom bar 

Server:

bool sendClientMessage ( string text, player thePlayer [, int r=0, int g=0, int b=0, bool topBar=true ] ) 

[b]Required Arguments[/b] 
Text - the text that will be outputed into the bar 
thePlayer - The player the message will be sent to (use root for all) 
[b]Optional Arguments[/b] 
r - The amount of red you want in the mixture of RGB (0-255 is valid) 
g - The amount of green you want in the mixture of RGB (0-255 is valid) 
b - The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar - If true then the message will be sent to the top bar, if false the it will be sent to the bottom bar 

Link to comment

Version 1.3:

Changelog:

- Added HEX color code support

- Added a optional time argument

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100, true, 8 ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100, false, 10 ) 
end ) 

I am still taking suggestions. Next version (if there is one) will be the last, unless a bug is found.

Link to comment
Version 1.3:

Changelog:

- Added HEX color code support

- Added a optional time argument

Syntax (server)

bool sendClientMessage ( string message, player thePlayer [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
thePlayer: The player that the message will be sent to (use root for all) 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Syntax (client)

bool sendClientMessage ( string message [, int r=255, int g=255, int b=255, bool topBar=true, int time=8 ] ) 

[b]Required Arguments[/b] 
message: The text that will be applied to the bar. 
  
[b]Optional Arguments[/b] 
r: The amount of red you want in the mixture of RGB (0-255 is valid) 
g: The amount of greeen you want in the mixture of RGB (0-255 is valid) 
b: The amount of blue you want in the mixture of RGB (0-255 is valid) 
topBar: If set to true, then the message will send to the top bar, otherwise to the bottom bar 
time: The time the message will stay on the screen [b](unless the number of messages hits the maximum) (in seconds)[/b] 

Examples:

-- Example 1: 
addEventHandler ( "onPlayerQuit", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has left the server.", root, 255, 100, 100, true, 8 ) 
end ) 
  
-- Example 2: 
addEventHandler ( "onPlayerJoin", root, function ( ) 
    exports["TopBarChat"]:sendClientMessage ( getPlayerName ( source ).." has connected to the server!", root, 255, 100, 100, false, 10 ) 
end ) 

I am still taking suggestions. Next version (if there is one) will be the last, unless a bug is found.

Very nice!

Link to comment
Now nothing to add is needed :P Maybe you can make animations for rectangles.

Note: I dont know if its bug but you cant send the same message more than 1 time.

Eh animations are to difficult to do... And thats not a bug. It won't show the same message twice. I did it to prevent a bug that would have occurred.

Very nice!

Thanks

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...