Raised This Month: $32 Target: $400
 8% 

Solved [CS GO] Problem with HUD Message !


Post New Thread Reply   
 
Thread Tools Display Modes
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-20-2018 , 17:49   Re: [CS GO] Problem with HUD Message !
Reply With Quote #11

Let me correct myself, unnecessary, but that's just my ocd taking over my eyes.

+ but "Called once a client is authorized and fully in-game".

what if the server is changing map and you join, then the timer won't even be fired anyways

that's my point :p

I'd use OnClientPutInServer

Last edited by mug1wara; 07-20-2018 at 18:08.
mug1wara is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 07-20-2018 , 18:21   Re: [CS GO] Problem with HUD Message !
Reply With Quote #12

Quote:
Originally Posted by mug1wara View Post
Let me correct myself, unnecessary, but that's just my ocd taking over my eyes.

+ but "Called once a client is authorized and fully in-game".

what if the server is changing map and you join, then the timer won't even be fired anyways

that's my point :p

I'd use OnClientPutInServer
Honestly, I have no idea what you are trying to say because none of that makes sense.

https://sm.alliedmods.net/new-api/cl...PostAdminCheck
Quote:
Called once a client is authorized and fully in-game, and after all post-connection authorizations have been performed.
This callback is guaranteed to occur on all clients, and always after each OnClientPutInServer() call.
PHP Code:
#include <sourcemod> 

#pragma semicolon 1 // Forces the compiler to read only after semicolons (;) [Optional]
#pragma newdecls required // Forces the compiler to read only in new syntax [Optional]

public void OnClientPostAdminCheck(int client) { 
    
CreateTimer(1.0Timer_MessageGetClientUserId(client), TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); // Pass the client's userid rather than index (for safety)
}  

public 
Action Timer_Message(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser); // Get client's index from userid

    
if (client <= MaxClients && IsClientInGame(client)) // Check if the client between 1 and 65 (valid player indexes). Also check if they're still in game.
    
{
        
SetHudTextParams(-1.0, -1.020.025525525525500.00.00.0); 
        
ShowHudText(client1"Hello World !!"); 
    }

Works exactly as it's intended to do.
Maxximou5 is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 07-20-2018 , 18:37   Re: [CS GO] Problem with HUD Message !
Reply With Quote #13

Quote:
Originally Posted by mug1wara View Post
Let me correct myself, unnecessary, but that's just my ocd taking over my eyes.

+ but "Called once a client is authorized and fully in-game".

what if the server is changing map and you join, then the timer won't even be fired anyways

that's my point :p

I'd use OnClientPutInServer
OnClientPutInServer is called before OnClientPostAdminCheck, therefore it wouldn't really make a difference? If anything, it's wiser to use PostAdminCheck. Adding the no map change flag prevents the timer from duplicating, since when the map changes, all the players disconnect and reconnect. It also prevents memory leaks by closing the timer handle OnMapEnd. Therefore, using OnClientPostAdminCheck and TIMER_FLAG_NO_MAPCHANGE flag are the best options in this situation.

Case closed.
__________________

Last edited by LenHard; 07-20-2018 at 18:39.
LenHard 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 18:22.


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