AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   B_RUSH Plugin (https://forums.alliedmods.net/showthread.php?t=89393)

minimiller 04-05-2009 20:21

B_RUSH Plugin
 
I'm currently into mapping and my friend wanted me to make a map specific to B_rush.
So i did, and its pretty good however there are a few bugs that hammer cannot fix =[

If you dont know what b_rush is, check this out:
Quote:

B-rush needs 8 players, 5T and 3 CT.
Normally it would be 4on4 and a knife round would be played to decide the teams.
The Ts need to rush bomb site B and CTs need to defend it.
If Ts win the round, the 3 who got kills go CT and the CTs who died go T.
If CTs win the round, the teams stay the same and the game continues.
If CTs win 8 or 10 rounds in a row, a new map is chosen and the CTs get to put "[DREAMTEAM]" in their name cos they r pro

There are a few rules:
NO flashbangs
NO sheilds
NO nade spamming from spawn (only an issue on certain maps, E.g. the 1 i made)
Ts must NOT run mid or any other route to get to B (They must use the shortest route) (E.g. de_inferno - rush banana, de_dust2 - rush tunnels)

Server side settings need to be:
mp_friendlyfire 0
mp_startmoney 801
mp_roundtime 1
mp_freezetime 0
sv_gravity 800
My code is as follows:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <cstrike>
#include <hamsandwich>

#pragma semicolon 1

new PLUG[] = "Stewie's B Rush";
new 
VERS[] = "1.0";
new 
AUTH[] = "Stewie!";

new 
gGame 0;
new 
gNewCtIds[3];
new 
gCtsDied 0;
new 
gReason[20];

new 
bool:gbGameInProgress false;

/*---------------------------------------------------------------------------------------------------------------------*/
/* plugin_init                                                                                                         */
/*-------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
public plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
register_cvar(PLUGVERSFCVAR_SERVER);
    
    
register_clcmd("say /start""start_game", -1);
    
    
register_clcmd("flash""block");
    
register_clcmd("shield""block");
    
    
RegisterHam(Ham_DeathNotice"player""player_death");
}

/*---------------------------------------------------------------------------------------------------------------------*/
/* House keeping                                                                                                       */
/*-------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
public client_connect(id)
{
    if(
get_playersnum() >= 9)
    {
        
formatex(gReason32"too many clients");
        
stop_brush();
    }
}

public 
client_disconnect(id)
{
    if(
get_playersnum() <= 7)
    {
        
formatex(gReason32"not enough clients");
        
stop_brush();
    }
}

/*---------------------------------------------------------------------------------------------------------------------*/
/* Start Game                                                                                                          */
/*-------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
public start_game()
{
    if(
gbGameInProgress)
    {
        
client_print(0print_chat"There is allready a game in progress!");
    }
    else
    {
        
gbGameInProgress true;
        
restart_round();
    }
}

/*---------------------------------------------------------------------------------------------------------------------*/
/* Player death                                                                                                        */
/*-------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
public player_death(victim)
{
    switch(
gGame)
    {
        case 
0// No Game
        
{
            return 
HAM_SUPERCEDE;
        }
        case 
1// Knife round
        
{
            if(
cs_get_user_team(victim) == CS_TEAM_CT)
            {
                
gNewCtIds[gCtsDied] = victim;
                
gCtsDied++;
            }
            
            if(
gCtsDied == 4)
            {
                for(new 
08i++)
                {
                    
cs_set_user_team(iCS_TEAM_T);
                    
make_cts();
                }
            }
        }
        case 
2// B Rush
        
{
            if(
cs_get_user_team(victim) == CS_TEAM_CT)
            {
                
gNewCtIds[gCtsDied] = victim;
                
gCtsDied++;
            }
            
            if(
gCtsDied == 4)
            {
                for(new 
08i++)
                {
                    
cs_set_user_team(iCS_TEAM_T);
                    
make_cts();
                }
            }
        }
    }
    return 
HAM_SUPERCEDE;
}

/*---------------------------------------------------------------------------------------------------------------------*/
/* Stocks n Stuff                                                                                                      */
/*-------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
public make_cts()
{
    switch(
gGame)
    {
        case 
0:
        {
            return 
PLUGIN_CONTINUE;
        }
        default:
        {
            
cs_set_user_team(gNewCtIds[0], CS_TEAM_CT);
            
cs_set_user_team(gNewCtIds[1], CS_TEAM_CT);
            
cs_set_user_team(gNewCtIds[2], CS_TEAM_CT);
            
            
gGame 2;
        }
    }
    
    
restart_round();
    return 
PLUGIN_CONTINUE;
}

public 
restart_round()
{
    
server_cmd("sv_restartround 1");
}

public 
stop_brush()
{
    
client_print(0print_chat"B rush has stopped due to %s"gReason);
    
set_task(1.1"restart_round");
    
set_task(2.1"restart_round");
    
set_task(3.1"restart_round");
}

public 
block()
{
    return 
PLUGIN_HANDLED;


Seeing as though i dont often have 7 other ppl willing to help test, i looked to using podbots, but they dont seem to follow the rules =[
So ive given up and im now asking for help
Any1 wanna give it a go?
Or maybe we could arrange 7 ppl to come help meh test at some point

vicken 02-11-2014 08:00

Re: B_RUSH Plugin
 
im in

jimaway 02-11-2014 08:27

Re: B_RUSH Plugin
 
public restart_round()
{
server_cmd("sv_restartround 1");
}

that is a cvar not a server command, use set_pcvar_num() native

wickedd 02-11-2014 19:53

Re: B_RUSH Plugin
 
Quote:

Originally Posted by vicken (Post 2098786)
im in

In what? Look at the date of this thread.

vicken 02-16-2014 10:00

Re: B_RUSH Plugin
 
have seen it. but maybe someone finished it ;D


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

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