AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Rounds left (https://forums.alliedmods.net/showthread.php?t=194409)

Artifact 08-28-2012 03:03

Rounds left
 
How can I catch how much rounds left?

claudiuhks 08-28-2012 03:55

Re: Rounds left
 
PHP Code:

new g_iRoundsCount 0;

GetRoundsLeft( )
  return 
get_cvar_num"mp_maxrounds" ) > ? ( get_cvar_num"mp_maxrounds" ) - g_iRoundsCount ) : -1;

public 
plugin_init( )
  
register_logevent"RoundEnd"2"1=Round_End" );

public 
client_connectiPlayer ) {
  static 
iRoundsLeft;
  
iRoundsLeft GetRoundsLeft( );

  if( 
iRoundsLeft != -&& iRoundsLeft <= ) {
    
//...
  
}
}

public 
RoundEnd( )
  
g_iRoundsCount++; 

I can't make sure if Game Commencing may do this function stop working.

Artifact 08-28-2012 05:14

Re: Rounds left
 
What mean ? character in
PHP Code:

  return get_cvar_num"mp_maxrounds" ) > ? ( get_cvar_num"mp_maxrounds" ) - g_iRoundsCount ) : -1


OvidiuS 08-28-2012 07:00

Re: Rounds left
 
Quote:

Originally Posted by Artifact (Post 1784858)
What mean ? character in
PHP Code:

  return get_cvar_num"mp_maxrounds" ) > ? ( get_cvar_num"mp_maxrounds" ) - g_iRoundsCount ) : -1


Code:
return get_cvar_num( "mp_maxrounds" ) > 0 ? ( get_cvar_num( "mp_maxrounds" ) - g_iRoundsCount ) : -1;
is equal to
Code:
if( get_cvar_num( "mp_maxrounds" ) > 0 )         return ( get_cvar_num( "mp_maxrounds" ) - g_iRoundsCount ); return -1;

Artifact 08-28-2012 07:34

Re: Rounds left
 
Aha oke :) Thanks


All times are GMT -4. The time now is 05:42.

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