AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Hud MSG Color ? (https://forums.alliedmods.net/showthread.php?t=277605)

abdobiskra 01-12-2016 08:45

[HELP] Hud MSG Color ?
 
Hi!
i want make Hud message display between two colors how i can do that ?

Such as lights :fox:

OciXCrom 01-12-2016 15:12

Re: [HELP] Hud MSG Color ?
 
You want the color to change color every X seconds or have two colors at the same time?

abdobiskra 01-13-2016 00:55

Re: [HELP] Hud MSG Color ?
 
i want the color balance in 1s between red and blue, for example, when the Red disappears it appears blue and vice versa

OciXCrom 01-13-2016 07:08

Re: [HELP] Hud MSG Color ?
 
So, change color every X seconds then?

abdobiskra 01-13-2016 23:58

Re: [HELP] Hud MSG Color ?
 
Can you give an example?

addons_zz 01-14-2016 05:55

Re: [HELP] Hud MSG Color ?
 
Quote:

Originally Posted by abdobiskra (Post 2383128)
Can you give an example?

Spoiler

abdobiskra 01-14-2016 08:24

Re: [HELP] Hud MSG Color ?
 
addons_zz

Thanks but how to make them among the only two colors?

ex: Blue & yellow
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


new g_current_color_red 255
new g_current_color_green 255
new g_current_color_blue 255

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say g""show_last_round_HUD")
    
    
// Add your code here...
}
public 
show_last_round_HUD(id)
{
    
g_current_color_red = ( g_current_color_red 50 ) % 256
    g_current_color_green 
= ( g_current_color_green 40 ) % 256
    g_current_color_blue 
= ( g_current_color_blue 30 ) % 256

    set_hudmessage
g_current_color_redg_current_color_greeng_current_color_blue,0.150.1500.01.00.10.1)
    
show_hudmessage(id"BLALALALLALLALALLLLALLALALAL ?")
    
   
// client_print(0, print_chat, " Hellow World ")



addons_zz 01-14-2016 08:57

Re: [HELP] Hud MSG Color ?
 
Quote:

Originally Posted by abdobiskra (Post 2383229)
Thanks but how to make them among the only two colors?

Create an array for r, g, and b, where each one, contain the color tone. Them use this to access its color:
Code:
new g_current_color_tone_index = 1 new g_red_color_tone[] = { 255, 120 } new g_green_color_tone[] = { 255, 120 } new g_blue_color_tone[]= { 255, 120 } ... some_function() {     ...     g_current_color_tone_index = ( g_current_color_tone_index + 1 ) % 2     set_hudmessage( g_red_color_tone[g_current_color_tone_index ], g_green_color_tone[g_current_color_tone_index ],             g_blue_color_tone[g_current_color_tone_index ], 0.15, 0.15, 0, 0.0, 1.0, 0.1, 0.1, 1 )     ... }

siriusmd99 01-14-2016 09:54

Re: [HELP] Hud MSG Color ?
 
Make a global boolean for blue and red switch.
Add at the top of your plugin:

new bool:g_red

And change

PHP Code:

set_hudmessageg_current_color_redg_current_color_greeng_current_color_blue,0.150.1500.01.00.10.1

to:

PHP Code:

public show_hud_msg(){
if(
g_red){
set_hudmessage00255,0.150.1500.01.00.10.1)
g_red false;
}else{
set_hudmessage25500,0.150.1500.01.00.10.1)
g_red true;
}
show_hudmessage(0"Colours are switching...")



Now every time when you execute function it will set 1 second hud message with switched colors.
So if you want message stays 10 seconds on screen and the color switches every second from red to blue and vice versa then set task, like:

PHP Code:

set_task(1.0,"show_hud_msg",_,_,_,"a"10


abdobiskra 01-16-2016 11:19

Re: [HELP] Hud MSG Color ?
 
I want to make the red color appears for 3 seconds before change to red and then the blue color shows for 3 seconds before change to red also ? how can i do that ?


All times are GMT -4. The time now is 09:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.