AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved How i can cheack if "hud_centerid 1" for the clients? (https://forums.alliedmods.net/showthread.php?t=316681)

abdobiskra 06-04-2019 16:13

How i can cheack if "hud_centerid 1" for the clients?
 
Hello, How can I verify that my client is setting up (hud_centerid 1) the activation setting?
In my poor code I tried three ways for it but it did not work:
PHP Code:

public client_PreThink(id) {
    
    
//test 1
    
new centerid1[32]
    
get_user_info(id"hud_centerid"centerid131)
        
    if ( 
centerid1[id] != ) {
        
client_print(idprint_chat"hud_centerid1 %d "centerid1)
    }
      
      
    
//test 2
    
new centerid2[16]
    
get_user_info(id"hud_centerid"centerid215)
        
    new 
hudcentrid2 str_to_num(centerid2)
        
    if (
hudcentrid2 != )
    {
        
client_print(idprint_chat"hud_centerid2 %d "hudcentrid2)
    }
    
    
    
//test 3
    
new centerid3[2]
    
    
get_user_info(id"hud_centerid"centerid31)
    
    if (
centerid3[0] == '1')
    {
        
client_print(idprint_chat"hud_centerid3 %d "centerid3)
    }
    return 
FMRES_IGNORED



<VeCo> 06-04-2019 16:33

Re: How i can cheack if "hud_centerid 1" for the clients?
 
query_client_cvar

get_user_info works only for values set with the setinfo command.

JocAnis 06-04-2019 17:30

Re: How i can cheack if "hud_centerid 1" for the clients?
 
And please think more when to use events which are called 10 or more times in a seconds...per player.. :/

abdobiskra 06-05-2019 07:31

Re: How i can cheack if "hud_centerid 1" for the clients?
 
Quote:

Originally Posted by <VeCo> (Post 2654371)
query_client_cvar

get_user_info works only for values set with the setinfo command.

Thank you.

Quote:

Originally Posted by JocAnis
And please think more when to use events which are called 10 or more times in a seconds...per player.. :/

These settings may help:
PHP Code:

    set_hudmessage(255255255, -1.00.6011.00.40.010.01, -1)
    
show_hudmessage(id,"%s %s",name,hp


JocAnis 06-05-2019 07:58

Re: How i can cheack if "hud_centerid 1" for the clients?
 
Quote:

Originally Posted by abdobiskra (Post 2654418)
These settings may help:
PHP Code:

    set_hudmessage(255255255, -1.00.6011.00.40.010.01, -1)
    
show_hudmessage(id,"%s %s",name,hp


i dont know what you meant by that, but i wanted to tell you dont use client_prethink for checking player cvar, there are less server-painful option for that :D

abdobiskra 06-05-2019 08:27

Re: How i can cheack if "hud_centerid 1" for the clients?
 
@JocAnis
I thought you were talking about the duration of the message!
Yes, Just I did it to check.


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

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