AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   1 for each team, don't going well :( (https://forums.alliedmods.net/showthread.php?t=95925)

TitANious 06-28-2009 18:14

1 for each team, don't going well :(
 
PHP Code:

demonid )
{
    for( new 
1<= max_clientsi++ )
    {
        if( ( 
get_user_teamid ) == ) && ( get_user_teamid ) == ) )
        {
            if( 
GotDemonicid ] >= get_pcvar_numpCvarPlayerAmount ) )
            {
                
client_printidprint_chat"Only %d players is allowed to be %s"get_pcvar_numpCvarPlayerAmount ), get_user_teamid ) )
            } 
            else 
            {
                if ( 
get_pcvar_num pCvarArmorOn ) )
                {
                    
set_user_armor idrandom_num 50255 ) )
                }    
                if ( 
get_pcvar_num pCvarHealthOn ) )
                {            
                    
set_user_health idrandom_num 50255 ) )
                }
                if ( 
get_pcvar_num pCvarSpeedOn ) )
                {
                    
set_user_maxspeed idrandom_float 230.0270.0 ) )
                }
                if ( 
get_pcvar_num pCvarGravityOn ) )
                {
                    
set_user_gravity idrandom_float 0.81.2 ) )
                }
                
set_user_rendering(idkRenderFxGlowShell2341150kRenderTransAlpha255); 
            }
        }
    }


That's the function i do in my demon plugin. I know that it don't work properly. Can anyone help me out?

Btw. It should only be this there should be looked at:
PHP Code:

demonid )
{
    for( new 
1<= max_clientsi++ )
    {
        if( ( 
get_user_teamid ) == ) && ( get_user_teamid ) == ) )
        {
            if( 
GotDemonicid ] >= get_pcvar_numpCvarPlayerAmount ) )
            {
                
client_printidprint_chat"Only %d players is allowed to be %s"get_pcvar_numpCvarPlayerAmount ), get_user_teamid ) )
            } 

And it should only be *pcvar* numbers of EACH team, there should could buy the demon

Dr.G 06-28-2009 18:39

Re: 1 for each team, don't going well :(
 
when will this happen????

PHP Code:

if( ( get_user_teamid ) == ) && ( get_user_teamid ) == ) ) 


Arkshine 06-29-2009 03:07

Re: 1 for each team, don't going well :(
 
For sure it can't work like that. Change && by ||. Or both by is_user_alive()

TitANious 06-29-2009 03:46

Re: 1 for each team, don't going well :(
 
Does anyone know a way to restrict it to only 1 player on each team?

@Arkshine and DR.G
I did it because it was a BAD try to make it.

minimiller 06-29-2009 04:26

Re: 1 for each team, don't going well :(
 
make a bool for each team and set it to false. then in your demon function, do:
if(!gbVar)
{
make_new_demon(id);
gbVar = true;
}

Bugsy 06-29-2009 07:32

Re: 1 for each team, don't going well :(
 
Do you want a player to keep his demonic only for the round it was issued? Or for the entire connection to server? Or until you issue a 'undemonic' command on player?

TitANious 06-29-2009 08:12

Re: 1 for each team, don't going well :(
 
It should only be a round. But it should be only one for each team :(

Bugsy 06-29-2009 08:22

Re: 1 for each team, don't going well :(
 
PHP Code:

new g_iGotDemonic];
new 
boolg_bIsDemonic33 ];
new 
g_iMaxPlayers;

register_logevent"fw_EvRoundStart" "1=Round_Start" );
g_iMaxPlayers get_maxplayers();

public 
fw_EvRoundStart()
{
    
g_iGotDemonic] = 0;
    
g_iGotDemonic] = 0;
    
    for ( new 
<= g_iMaxPlayers i++ )
        
g_bIsDemonic] = false;  
}

public 
demonid )
{
    if ( !
is_user_aliveid ) || g_bIsDemonicid ] )
        return;
        
    static 
iTeamiTeam get_user_teamid );
    static 
iCVarValiCVarVal get_pcvar_numpCvarPlayerAmount );

    if( 
iCVarVal && ( <= iTeam <= ) )
    {
        if( 
g_iGotDemoniciTeam ] >= iCVarVal )
        {
            
client_printidprint_chat"* Only %d %s player%s allowed to be demonic!" iCVarVal , ( iTeam == ) ? "Terrorist" "Counter-Terrorist" , ( iCVarVal == ) ? " is" "s are" )
        }
        else 
        {
            
client_printid print_chat "* You are now demonic" );
            
            
g_iGotDemoniciTeam ]++;
            
g_bIsDemonicid ] = true;
            
            if ( 
get_pcvar_num pCvarArmorOn ) ) set_user_armor idrandom_num 50255 ) )
            if ( 
get_pcvar_num pCvarHealthOn ) ) set_user_health idrandom_num 50255 ) )
            if ( 
get_pcvar_num pCvarSpeedOn ) ) set_user_maxspeed idrandom_float 230.0270.0 ) )
            if ( 
get_pcvar_num pCvarGravityOn ) ) set_user_gravity idrandom_float 0.81.2 ) )
    
            
set_user_rendering(idkRenderFxGlowShell2341150kRenderTransAlpha255); 
        }
    }



TitANious 06-29-2009 08:55

Re: 1 for each team, don't going well :(
 
What is all the ? and : like that means in this?
PHP Code:

client_printidprint_chat"* Only %d %s player%s allowed to be demonic!" iCVarVal , ( iTeam == ) ? "Terrorist" "Counter-Terrorist" , ( iCVarVal == ) ? " is" "s are" 


Bugsy 06-29-2009 08:58

Re: 1 for each team, don't going well :(
 
Quote:

Originally Posted by TitANious (Post 860017)
What is all the ? and : like that means in this?
PHP Code:

client_printidprint_chat"* Only %d %s player%s allowed to be demonic!" iCVarVal , ( iTeam == ) ? "Terrorist" "Counter-Terrorist" , ( iCVarVal == ) ? " is" "s are" 


That will make the print look grammatically proper regardless of the number.

ie.

Only 1 player is allowed to be demonic
Only 2 players are allowed to be demonic
Only 9 players are allowed to be demonic


All times are GMT -4. The time now is 15:29.

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