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

Ace, mini ACE code, messages.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nbanow
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 01-15-2012 , 06:38   Ace, mini ACE code, messages.
Reply With Quote #1

Hello guys! I would be grateful if someone help me to make a code.
I have Gather / Clan match plugin, I need to add mini ACE - when player kill 4 / 5 players and "ACE" - when player kill 5 / 5 players.

When player killed 5 / 4 players, client_print message should say: "Player "nick" made a mini ACE! Good Job"
When player killed 5 / 5 players, client_print message should say: "Player "nick" made an ACE! Good Job"

Also, mini ACE and ACE should be only in "live" mode, when it's warmup, aces , mini aces, should't be published!

For now my plugin is doing only simple things, auto team switch after 15 rounds, counting every round team scores, and other simple things.


This is my plugin current code:
Code:
#include < amxmodx >
#include < cstrike >

// team names
// CS_TEAM_UNASSIGNED
// CS_TEAM_T
// CS_TEAM_CT
// CS_TEAM_SPECTATOR
new const TeamNames[ CsTeams ][ ] =
{
    "",
    "Terrorist",
    "Counter-Terrorist",
    ""
};

// variable holding the current round
new CurrentRound;

// bool whether it's the 15th round or not
new bool:LastRound;

// current team round count
new RoundsWon[ CsTeams ];

// holding get_maxplayers( ) value
new MaxPlayers;

public plugin_init( )
{  
  register_clcmd( "say /score", "ClientCommand_Score" );
    
    register_clcmd( "live", "ClientCommand_Live" );
    register_clcmd( "warmup", "ClientCommand_Warmup" );
    
    // hook round start
    register_logevent( "LogEvent_RoundStart", 2, "1=Round_Start" );
    
    // hook round win
    register_event( "SendAudio", "Event_SendAudio_TWin", "a", "2&%!MRAD_terwin" );
    register_event( "SendAudio", "Event_SendAudio_CTWin", "a", "2&%!MRAD_ctwin" );

    // assign MaxPlayers the value of get_maxplayers( )
    MaxPlayers = get_maxplayers( );

    state warmup;
}

public ClientCommand_Score( Client ) <warmup>
{
    // print score (in this case warmup doesn't have any scores.. so print a message)
    client_print( Client, print_chat, "Game mode is currently in Warmup mode - no scores available!" );
}

public ClientCommand_Score( Client ) <live>
{
    // print score
    client_print( Client, print_chat, "CT Score: %i T Score: %i", RoundsWon[ CS_TEAM_CT ], RoundsWon[ CS_TEAM_T ] );
}

public ClientCommand_Live( Client )
{
    // switch state to live
    state live;
    
    RoundsWon[ CS_TEAM_CT ] = 0;
    RoundsWon[ CS_TEAM_T ] = 0;
    
    Reset( );
}

public ClientCommand_Warmup( Client )
{
    // switch state to warmup
    state warmup;
    
    Reset( );
}

public LogEvent_RoundStart( ) <warmup>
{
    // print every warmup round
    client_print( 0, print_chat, "Warmup Round", RoundsWon[ CS_TEAM_CT ], RoundsWon[ CS_TEAM_T ] );
}

public LogEvent_RoundStart( ) <live>
{
    // increment round counter
    CurrentRound++;

    client_print( 0, print_chat, "CT Score: %i T Score: %i", RoundsWon[ CS_TEAM_CT ], RoundsWon[ CS_TEAM_T ] );

    // check if rounds == 15, if so, set last true (will be handled when round is won by a team)
    if( CurrentRound == 15 )
    {
        client_print( 0, print_chat, "This is the last round before switching teams!" );
        
        LastRound = true;
    }
}

public Event_SendAudio_TWin( ) <warmup> { }
public Event_SendAudio_TWin( ) <live>
{
    // increment the team round counter for T team
    RoundsWon[ CS_TEAM_T ]++;
    
    // check if they have 16 rounds in the bag
    CheckWinner( CS_TEAM_T );
    
    // if it's the 15th round, reset the round counter, and swap team scores
    if( LastRound )
    {
        Reset( );
        
        Swap( );
    }
}

public Event_SendAudio_CTWin( ) <warmup> { }
public Event_SendAudio_CTWin( ) <live>
{
    // increment the team round counter for CT team
    RoundsWon[ CS_TEAM_CT ]++;
    
    // check if they have 16 rounds in the bag
    CheckWinner( CS_TEAM_CT );
    
    // if it's the 15th round, reset the round counter, and swap team scores
    if( LastRound )
    {
        Reset( );
        
        Swap( );
    }
}

CheckWinner( CsTeams:Team )
{
    // check if team has won 15 rounds
    if( RoundsWon[ Team ] == 15 )
    {
        client_print( 0, print_chat, "%s team has won 15 rounds now - they're only one away from winning!", TeamNames[ Team ] );
    }
    // check if team has won 16 rounds
    else if( RoundsWon[ Team ] == 16 )
    {
        client_print( 0, print_chat, "%s team has won 16 rounds now, resetting!", TeamNames[ Team ] );
        
        // reset
        Reset( true );
    }
}

Reset( bool:TeamWon = false )
{
    // check if a teamwon is true (false by default), if so (see comment below)
    if( TeamWon )
    {
        // reset rounds for terrorists and cts
        for( new CsTeams:Team = CS_TEAM_T; Team <= CS_TEAM_CT; Team++ )
        {
            RoundsWon[ Team ] = 0;
        }
    }
    
    // set round counter to 0
    CurrentRound = 0;
    
    // restart round
    server_cmd( "sv_restartround 1" );
    
    // set last round false
    LastRound = false;
}

Swap( )
{
    // iterate through all players
    for( new PlayerIndex = 1; PlayerIndex <= MaxPlayers; PlayerIndex++ )
    {
        // check if connected
        if( is_user_connected( PlayerIndex ) )
        {
            // swap team
            switch( cs_get_user_team( PlayerIndex ) )
            {
                case CS_TEAM_T: cs_set_user_team( PlayerIndex, CS_TEAM_CT );
                case CS_TEAM_CT: cs_set_user_team( PlayerIndex, CS_TEAM_T );
            }
        }
    }
    
    // swap scores
    new TempScore = RoundsWon[ CS_TEAM_T ];
    RoundsWon[ CS_TEAM_T ] = RoundsWon[ CS_TEAM_CT ];
    RoundsWon[ CS_TEAM_CT ] = TempScore;
}
I hope somebody will help me to add these Aces , mini Aces codes! I'm just a newbie.
Thank you!
(Sorry for my AWFUL english language).

Last edited by Nbanow; 06-11-2012 at 03:35. Reason: Grammar fails.
Nbanow is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 01-15-2012 , 13:53   Re: Ace, mini ACE code, messages.
Reply With Quote #2

Check Ham_Kill or Deathmsg, then use a variable to add his frags.
fireattack is offline
Old 02-04-2012, 09:38
deoil
This message has been deleted by Exolent[jNr]. Reason: Cross-post.
Nbanow
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 06-11-2012 , 03:36   Re: Ace, mini ACE code, messages.
Reply With Quote #3

Anyone of you guys can't help to make it? I can't make it myself, because I need a lot of practise to make it.. Just a newbie.
Nbanow is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-11-2012 , 04:12   Re: Ace, mini ACE code, messages.
Reply With Quote #4

Nbanow, if you want to request a plugin, that's not the right section. Be careful next time.

Moved to Requests/Suggestions section.
__________________
Arkshine is offline
Nbanow
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 06-11-2012 , 14:28   Re: Ace, mini ACE code, messages.
Reply With Quote #5

Arkshine, thank you for alert. I will be careful next time, I just didn't noticed, I was hoping that I am doing everything correctly.
Nbanow 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 04:38.


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