AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   stop the count when reached the number (https://forums.alliedmods.net/showthread.php?t=112910)

tuty 12-22-2009 02:56

stop the count when reached the number
 
hi guys, i have this ....

PHP Code:

public forward_killid )
{
    if( 
bKillid ] > MAX_KILLS )
    {
        
bKillid ] = MAX_KILLS;
        return 
FMRES_IGNORED;
    }

    if( 
bKillid ] == MAX_KILLS )
    {
        
get_user_nameidszNamecharsmaxszName ) );
        
        
color_print0"^3%s^1 has reached the number %d!"nameMAX_KILLS );
       
bKillid ] = MAX_KILLS;
    }

    
bKillid ] += 1;

    return 
FMRES_IGNORED;


well i want the bKill[ id ] stops permanently when has reachedthe max kills number... because if i reach the maxkills number says in chat, but the count doesnt stop.
help

xPaw 12-22-2009 04:29

Re: stop the count when reached the number
 
Something like this ?
Code:
public forward_kill( id ) {     if( bKill[ id ] >= MAX_KILLS )     {     //  bKill[ id ] = MAX_KILLS;         return FMRES_IGNORED;     }         if( ++bKill[ id ] == MAX_KILLS )     {         get_user_name( id, szName, charsmax( szName ) );                 color_print( 0, "^3%s^1 has reached the number %d!", name, MAX_KILLS );         bKill[ id ] = MAX_KILLS;     }         return FMRES_IGNORED; }

joaquimandrade 12-22-2009 04:31

Re: stop the count when reached the number
 
You want that when he reaches the max value it displays the max value on every kill? If so:

PHP Code:

public forward_killid )
{    
    if( 
bKillid ] == MAX_KILLS )
    {
        
get_user_nameidszNamecharsmaxszName ) );
        
        
color_print0"^3%s^1 has reached the number %d!"nameMAX_KILLS );      
    }
    else if( 
bKillid ] < MAX_KILLS )
    {
        
bKillid ]++;
    }


If you don't want it to display
PHP Code:

public forward_killid )
{    
    if( 
bKillid ] == MAX_KILLS )
    {
        
get_user_nameidszNamecharsmaxszName ) );
        
        
color_print0"^3%s^1 has reached the number %d!"nameMAX_KILLS );   
    }
    
    if( 
bKillid ] <= MAX_KILLS )
    {
        
bKillid ]++;
    }


And if you want to use bKill[ id ] in another place having its MAX_VALUE at MAX_KILLS but you don't want the message to appear in every kill saying that you have the MAX_VALUE you must use it like

PHP Code:

bKillid ] > MAX_KILLS MAX_KILLS bKillid 

because if you do

PHP Code:

bKillid ] = MAX_KILLS 

the message will appear again in the next kill

Edit:

Nevermind the last part of what I said. Do this:

PHP Code:

public forward_killid )
{       
    if( 
bKillid ] < MAX_KILLS )
    {
        if( ++
bKillid ] == MAX_KILLS )
        {
            
get_user_nameidszNamecharsmaxszName ) );        
            
color_print0"^3%s^1 has reached the number %d!"nameMAX_KILLS );  
        }
    }



tuty 12-22-2009 05:18

Re: stop the count when reached the number
 
thank you both ... works fine -.-


All times are GMT -4. The time now is 04:02.

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