Raised This Month: $ Target: $400
 0% 

hud colors with cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-05-2013 , 04:11   Re: hud colors with cvar
Reply With Quote #1

Quote:
Originally Posted by DeagLe.Studio View Post
Try something like this:
Code:
#include <amxmodx> #include <amxmisc> new const PLUGIN[]  = "Connect adv" new const VERSION[] = "1.3" new const AUTHOR[]  = "none" new hudmessage1, HudOn, ChatOn, HudColor public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         hudmessage1 = CreateHudSyncObj()         ChatOn = register_cvar("conn_chat", "1")     HudOn = register_cvar("conn_hud", "1")     HudColor = register_cvar("conn_hud_color", "000 255 000" );         register_dictionary("connrekl.txt") } public client_putinserver(id) {         if(!is_user_bot(id))     {         set_task(20.0, "ShowMsg", id)     } } public ShowMsg(id) {     if(get_pcvar_num(ChatOn))     {         client_print(id, print_chat, "%L", id, "REKLAMA_CHAT")     }         if(get_pcvar_num(HudOn))     {     static Colors[ 12 ], RealColors[ 9 ]; // instead of [ 3 ][ 3 ], let's make it  3 * 3     get_pcvar_string( HudColor, Colors, charsmax( Colors ) );     parse( Colors, RealColors[ 0 ], charsmax( RealColors ), RealColors[ 1 ], charsmax( RealColors ), RealColors[ 2 ], charsmax( RealColors ) );     set_hudmessage(str_to_num( RealColors[ 0 ] ), str_to_num( RealColors[ 2 ] ), str_to_num( RealColors[ 3 ] ), 0.02, 0.27, 1, 0.5, 10.0)     ShowSyncHudMsg(id, hudmessage1, "%L", id, "REKLAMA_HUD")     } } public client_disconnect(id) {     remove_task(id) }
No! You need to learn how strings work.

PHP Code:
    new szColors[16]
    new 
szRed[4], szGreen[4], szBlue[4]
    new 
iRediGreeniBlue
    
    get_pcvar_string
(cvar_pointer_hereszColorscharsmax(szColors))
    
parse(szColorsszRedcharsmax(szRed), szGreencharsmax(szGreen), szBluecharsmax(szBlue))
    
iRed str_to_num(szRed); iGreen str_to_num(szGreen); iBlue str_to_num(szBlue); 
__________________
fysiks is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-05-2013 , 04:17   Re: hud colors with cvar
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
No! You need to learn how strings work.

PHP Code:
    new szColors[16]
    new 
szRed[4], szGreen[4], szBlue[4]
    new 
iRediGreeniBlue
    
    get_pcvar_string
(cvar_pointer_hereszColorscharsmax(szColors))
    
parse(szColorsszRedcharsmax(szRed), szGreencharsmax(szGreen), szBluecharsmax(szBlue))
    
iRed str_to_num(szRed); iGreen str_to_num(szGreen); iBlue str_to_num(szBlue); 
you are right
TheDS1337 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:20.


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