Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-28-2009 , 18:14   1 for each team, don't going well :(
Reply With Quote #1

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
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Dr.G
Senior Member
Join Date: Nov 2008
Old 06-28-2009 , 18:39   Re: 1 for each team, don't going well :(
Reply With Quote #2

when will this happen????

PHP Code:
if( ( get_user_teamid ) == ) && ( get_user_teamid ) == ) ) 
__________________
Dr.G is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-29-2009 , 03:07   Re: 1 for each team, don't going well :(
Reply With Quote #3

For sure it can't work like that. Change && by ||. Or both by is_user_alive()
__________________
Arkshine is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-29-2009 , 03:46   Re: 1 for each team, don't going well :(
Reply With Quote #4

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.
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 06-29-2009 , 04:26   Re: 1 for each team, don't going well :(
Reply With Quote #5

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;
}
__________________
minimiller is offline
Send a message via MSN to minimiller
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-29-2009 , 07:32   Re: 1 for each team, don't going well :(
Reply With Quote #6

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?
__________________

Last edited by Bugsy; 06-29-2009 at 07:52.
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-29-2009 , 08:12   Re: 1 for each team, don't going well :(
Reply With Quote #7

It should only be a round. But it should be only one for each team
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-29-2009 , 08:22   Re: 1 for each team, don't going well :(
Reply With Quote #8

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); 
        }
    }

__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-29-2009 , 08:55   Re: 1 for each team, don't going well :(
Reply With Quote #9

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" 
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-29-2009 , 08:58   Re: 1 for each team, don't going well :(
Reply With Quote #10

Quote:
Originally Posted by TitANious View Post
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
__________________
Bugsy 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 15:29.


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