Wavelength Logo
tl.jpg (2351 bytes) blank.gif (837 bytes) tr.jpg (2446 bytes)
blank.gif (837 bytes)
Startup Edits by Dr Schwa
blank.gif (837 bytes)
 

Summary: Specify the weapons and ammo players spawn with via your server.cfg or listenserver.cfg

------------------------------------------------------------------------------------------------
game.cpp: Add the following code underneath the line
cvar_t    allowmonsters={"mp_allowmonsters","0", FCVAR_SERVER };

// Added by Schwa
cvar_t    startwith_crowbar        = {"startwith_crowbar", "1", FCVAR_SERVER };
cvar_t    startwith_9mmhandgun        = {"startwith_9mmhandgun", "1", FCVAR_SERVER };
cvar_t    startwith_9mmAR             = {"startwith_9mmAR", "0", FCVAR_SERVER };
cvar_t    startwith_shotgun        = {"startwith_shotgun", "0", FCVAR_SERVER };
cvar_t    startwith_crossbow        = {"startwith_crossbow", "0", FCVAR_SERVER };
cvar_t    startwith_357             = {"startwith_357", "0", FCVAR_SERVER };
cvar_t    startwith_hornetgun        = {"startwith_hornetfun","0", FCVAR_SERVER };
cvar_t    startwith_rpg             = {"startwith_rpg", "0", FCVAR_SERVER };
cvar_t    startwith_gauss             = {"startwith_gauss", "0", FCVAR_SERVER };
cvar_t    startwith_egon             = {"startwith_egon", "0", FCVAR_SERVER };

// Added by Schwa
cvar_t    initial_ammo_9mmclip        = {"initial_ammo_9mmclip", "68", FCVAR_SERVER };
cvar_t    initial_ammo_9mmAR        = {"initial_ammo_9mmAR", "0", FCVAR_SERVER };
cvar_t    initial_ammo_ARgrenades         = {"initial_ammo_ARgrenades", "0", FCVAR_SERVER };
cvar_t    initial_ammo_buckshot        = {"initial_ammo_buckshot", "0", FCVAR_SERVER };
cvar_t    initial_ammo_crossbow        = {"initial_ammo_crossbow", "0", FCVAR_SERVER };
cvar_t    initial_ammo_357        = {"initial_ammo_357", "0", FCVAR_SERVER };
cvar_t    initial_ammo_rpgclip        = {"initial_ammo_rpgclip", "0", FCVAR_SERVER };
cvar_t    initial_ammo_gaussclip         = {"initial_ammo_gaussclip", "0", FCVAR_SERVER };

// Added by Schwa
cvar_t    initial_ammo_handgrenade    = {"initial_ammo_handgrenade", "0", FCVAR_SERVER };
cvar_t    initial_ammo_tripmine        = {"initial_ammo_tripmine", "0", FCVAR_SERVER };
cvar_t    initial_ammo_satchel        = {"initial_ammo_satchel", "0", FCVAR_SERVER };
cvar_t    initial_ammo_snark        = {"initial_ammo_snark", "0", FCVAR_SERVER };


That section sets up the variable names, their default value, and where to find them (server.cfg)
------------------------------------------------------------------------------------------------
game.cpp: Add the following code underneath the line:
    CVAR_REGISTER (&allowmonsters);

    // Added by Schwa
    CVAR_REGISTER (&startwith_crowbar);
    CVAR_REGISTER (&startwith_9mmhandgun);
    CVAR_REGISTER (&startwith_9mmAR);
    CVAR_REGISTER (&startwith_shotgun);
    CVAR_REGISTER (&startwith_crossbow);
    CVAR_REGISTER (&startwith_357);
    CVAR_REGISTER (&startwith_hornetgun);
    CVAR_REGISTER (&startwith_rpg);
    CVAR_REGISTER (&startwith_gauss);
    CVAR_REGISTER (&startwith_egon);

    // Added by Schwa
    CVAR_REGISTER (&initial_ammo_9mmclip);
    CVAR_REGISTER (&initial_ammo_9mmAR);
    CVAR_REGISTER (&initial_ammo_ARgrenades);
    CVAR_REGISTER (&initial_ammo_buckshot);
    CVAR_REGISTER (&initial_ammo_crossbow);
    CVAR_REGISTER (&initial_ammo_357);
    CVAR_REGISTER (&initial_ammo_rpgclip);
    CVAR_REGISTER (&initial_ammo_gaussclip);

    // Added by Schwa
    CVAR_REGISTER (&initial_ammo_handgrenade);
    CVAR_REGISTER (&initial_ammo_tripmine);
    CVAR_REGISTER (&initial_ammo_satchel);
    CVAR_REGISTER (&initial_ammo_snark);


That section registers the variables with the game engine.
-----------------------
multiplay_gamerules.cpp: Change the Player_Spawn function to look like the following.

void CHalfLifeMultiplay :: PlayerSpawn( CBasePlayer *pPlayer )
{
    BOOL        addDefault;
    CBaseEntity    *pWeaponEntity = NULL;

    pPlayer->pev->weapons |= (1<<WEAPON_SUIT);

    addDefault = TRUE;

    while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
    {
        pWeaponEntity->Touch( pPlayer );
        addDefault = FALSE;
    }

    // Added by Schwa
    int startwith_crowbar = (int)CVAR_GET_FLOAT("startwith_crowbar");
    int startwith_9mmhandgun = (int)CVAR_GET_FLOAT("startwith_9mmhandgun");
    int startwith_9mmAR = (int)CVAR_GET_FLOAT("startwith_9mmAR");
    int startwith_shotgun = (int)CVAR_GET_FLOAT("startwith_shotgun");
    int startwith_crossbow = (int)CVAR_GET_FLOAT("startwith_crossbow");
    int startwith_357 = (int)CVAR_GET_FLOAT("startwith_357");
    int startwith_hornetgun = (int)CVAR_GET_FLOAT("startwith_hornetgun");
    int startwith_rpg = (int)CVAR_GET_FLOAT("startwith_rpg");
    int startwith_gauss = (int)CVAR_GET_FLOAT("startwith_gauss");
    int startwith_egon = (int)CVAR_GET_FLOAT("startwith_egon");

    // Added by Schwa
    int initial_ammo_9mmclip = (int)CVAR_GET_FLOAT("initial_ammo_9mmclip");
    int initial_ammo_9mmAR = (int)CVAR_GET_FLOAT("initial_ammo_9mmAR");
    int initial_ammo_ARgrenades = (int)CVAR_GET_FLOAT("initial_ammo_ARgrenades");
    int initial_ammo_buckshot = (int)CVAR_GET_FLOAT("initial_ammo_buckshot");
    int initial_ammo_crossbow = (int)CVAR_GET_FLOAT("initial_ammo_crossbow");
    int initial_ammo_357 = (int)CVAR_GET_FLOAT("initial_ammo_357");
    int initial_ammo_rpgclip = (int)CVAR_GET_FLOAT("initial_ammo_rpgclip");
    int initial_ammo_gaussclip = (int)CVAR_GET_FLOAT("initial_ammo_gaussclip");

    // Added by Schwa
    int initial_ammo_handgrenade = (int)CVAR_GET_FLOAT("initial_ammo_handgrenade");
    int initial_ammo_tripmine = (int)CVAR_GET_FLOAT("initial_ammo_tripmine");
    int initial_ammo_satchel = (int)CVAR_GET_FLOAT("initial_ammo_satchel");
    int initial_ammo_snark = (int)CVAR_GET_FLOAT("initial_ammo_snark");

    // Added by Schwa
    //
    // Give start up weapons and initial ammo
    // Initial ammo is given even if they aren't given the weapons it uses
    // To change that just throw in GiveAmmo line inside the previous if statement

    if ( startwith_crowbar )    {
        pPlayer->GiveNamedItem( "weapon_crowbar" );
    }

    // 9mm, otherwise known as the Glock
    if ( startwith_9mmhandgun ) {
        pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
    }
    pPlayer->GiveAmmo( initial_ammo_9mmclip, "9mm", _9MM_MAX_CARRY );

    // 9mm Automatic Rifle, otherwise known as my favorite weapon :-)
    if ( startwith_9mmAR ) {
        pPlayer->GiveNamedItem( "weapon_9mmAR" );
    }
    pPlayer->GiveAmmo( initial_ammo_ARgrenades, "ARgrenades", M203_GRENADE_MAX_CARRY );

    if ( startwith_shotgun ) {
        pPlayer->GiveNamedItem( "weapon_shotgun" );
    }
    pPlayer->GiveAmmo( initial_ammo_buckshot, "buckshot", BUCKSHOT_MAX_CARRY );

    if ( startwith_crossbow ) {
        pPlayer->GiveNamedItem( "weapon_crossbow" );
    }
    pPlayer->GiveAmmo( initial_ammo_crossbow, "bolt", BOLT_MAX_CARRY );

    // 357, otherwise known as the Python
    if ( startwith_357 ) {
        pPlayer->GiveNamedItem( "weapon_357" );
    }
    pPlayer->GiveAmmo( initial_ammo_357, "357", _357_MAX_CARRY );

    if ( startwith_hornetgun ) {
        pPlayer->GiveNamedItem( "weapon_hornetgun" );
    }

    if ( startwith_rpg ) {
        pPlayer->GiveNamedItem( "weapon_rpg" );
    }
    pPlayer->GiveAmmo( initial_ammo_rpgclip, "rockets", ROCKET_MAX_CARRY );   

    // Uranium based weapons
    if ( startwith_gauss ) {
        pPlayer->GiveNamedItem( "weapon_gauss" );
    }

    if ( startwith_egon ) {
        pPlayer->GiveNamedItem( "weapon_egon" );
    }
    pPlayer->GiveAmmo( initial_ammo_gaussclip, "uranium", URANIUM_MAX_CARRY );   

    // Ammoless Weapons
    for ( int i = 1; i <= initial_ammo_handgrenade; i++ ) {
        pPlayer->GiveNamedItem( "weapon_handgrenade" );
    }

    for ( i = 1; i <= initial_ammo_tripmine; i++ ) {
        pPlayer->GiveNamedItem( "weapon_tripmine" );
    }

    for ( i = 1; i <= initial_ammo_satchel; i++ ) {
        pPlayer->GiveNamedItem( "weapon_satchel" );
    }

    for ( i = 1; i <= initial_ammo_snark; i++ ) {
        pPlayer->GiveNamedItem( "weapon_snark" );
    }
}


That section actually gives you the weapons each time you spawn

------------------------------------------------------------------------------------------------
Once you've succesfully compiled this edit, you'll want to add to your server.cfg or listenserver.cfg the following line:

// Weapons you spawn with
// 1 = yes, 0 = no
startwith_crowbar    1    // unlimited ammo!    
startwith_9mmhandgun    1   
startwith_9mmAR        1
startwith_shotgun    1    // comes with 8 bullets
startwith_crossbow    1    // comes with 5 bolts
startwith_357        1    // comes with 6 bullets
startwith_hornetgun    1    // generates it's own ammo
startwith_rpg        1    // comes with 1 rocket
startwith_gauss        1    // comes with 20 units of uranium
startwith_egon        1    // comes with 20 units of uranium

initial_ammo_9mmclip    150    // for 9mmhandgun and 9mmAR
initial_ammo_ARgrenades    3    // for 9mmAR
initial_ammo_buckshot    32    // for shotgun
initial_ammo_crossbow    2   
initial_ammo_357    18    // for 357
initial_ammo_rpgclip    1    // for rocket launcher : 1 clip = 2 rockets
initial_ammo_gaussclip    50    // for gauss and egon (uranium)

// Ammoless Weapons
initial_ammo_handgrenade    2    // 1 = 5 grenades
initial_ammo_tripmine        2
initial_ammo_satchel        2
initial_ammo_snark        2    // 1 = 5 snarks
 

 

 

blank.gif (837 bytes)
bl.jpg (2471 bytes) blank.gif (837 bytes) br.jpg (2132 bytes)