Raised This Month: $51 Target: $400
 12% 

[CS:S] PrintCenterText only if player is not alive


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Misterpown
Senior Member
Join Date: Jan 2011
Old 06-25-2013 , 14:00   [CS:S] PrintCenterText only if player is not alive
Reply With Quote #1

Hello,

I wish it PrintCenterText appears if the player died, I tested if PlayerIsAlive, but it does not work, the Print is all the time:

Code:
CreateTimer(1.0, mort, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

public Action:mort(Handle:timer, any:client)
{
    for(new i = 1; i <= MaxClients; i++) 
    { 
        if(IsClientInGame(i) && player_respawn_wait[i] > 0) 
        { 
            PrintCenterText(i, "En cours de réanimation : %d secondes", player_respawn_wait[i]); 
        } 
    } 
	return Plugin_Handled;
}
Thank you!
Misterpown is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 06-25-2013 , 14:14   Re: [CS:S] PrintCenterText only if player is not alive
Reply With Quote #2

Here (btw, no need to have any:client in the timer callback if you're not passing it). Also, you could probably have that timer fire every 3 seconds... I forget how long center text stays on screen (maybe it's only one second, I forget).

PlayerIsAlive is wrong, it's IsPlayerAlive

PHP Code:
CreateTimer(1.0mort_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

public 
Action:mort(Handle:timer)
{
    for(new 
1<= MaxClientsi++) 
    { 
        if(
IsClientInGame(i) && !IsPlayerAlive(i) && player_respawn_wait[i] > 0
        { 
            
PrintCenterText(i"En cours de réanimation : %d secondes"player_respawn_wait[i]); 
        } 
    } 
    return 
Plugin_Handled// Maybe Plugin_Continue;?

__________________
View my Plugins | Donate

Last edited by TnTSCS; 06-25-2013 at 14:15.
TnTSCS is offline
NinjaSK
Senior Member
Join Date: Sep 2012
Old 06-25-2013 , 14:15   Re: [CS:S] PrintCenterText only if player is not alive
Reply With Quote #3

did you hook player_death event?

post your entire code
NinjaSK is offline
Misterpown
Senior Member
Join Date: Jan 2011
Old 06-26-2013 , 10:07   Re: [CS:S] PrintCenterText only if player is not alive
Reply With Quote #4

Thx TnTSCS, it work !
Misterpown is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 06-26-2013 , 10:48   Re: [CS:S] PrintCenterText only if player is not alive
Reply With Quote #5

Quote:
Originally Posted by TnTSCS View Post
I forget how long center text stays on screen (maybe it's only one second, I forget).
The client cvar scr_centertime controls how long HUD text remains on-screen, in seconds; it defaults to 2 in CS:S.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP 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 12:23.


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