Results 1 to 6 of 6

Thread: Removing weapons out of a Map via script

  1. #1
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts

    Removing weapons out of a Map via script

    Hello,
    often you have that problem:
    You download nice maps, run zombie gametype or rifle and then there are weapons inside the map.
    To remove them out add a file named _rWeapons.gsc into the maps\mp\gametypes folder.

    Open the GAMETYPE.gsc (zom.gsc, tdm.gsc) and go to main()

    Add the following line:
    PHP Code:
    thread maps\mp\gametypes\_rWeapons::init(); 
    _rWeapons.gsc file:
    PHP Code:
    //This script is writen by Earliboy
    //You got full access to use this file and edit it.
    //If you have any questions, contact me at Xfire: earliboy or skype: earliboy
    //If you find any issues, please contact me!

    //Adding a new weapon:
    //rmWeapon("weapon_NAME_mp");
    //Example: rmWeapon("weapon_mp44_mp");

    //Add following line to your server.cfg
    //set scr_remove_weapons "1"
    //"1" = On (remove weapons) "0" = Off (don't remove weapons)

    init()
    {
        if(
    getCvar("scr_remove_weapons") == "")
            
    setCvar("scr_remove_weapons","1");
        
        
    level.rmWeapons getCvarInt("scr_remove_weapons");
        
        if(!
    level.rmWeapons)
            return;
        
        
    rmWeapon("weapon_greasegun_mp");
        
    rmWeapon("weapon_m1carbine_mp");
        
    rmWeapon("weapon_m1garand_mp");
        
    rmWeapon("weapon_springfield_mp");
        
    rmWeapon("weapon_thompson_mp");
        
    rmWeapon("weapon_bar_mp");
        
    rmWeapon("weapon_sten_mp");
        
    rmWeapon("weapon_enfield_mp");
        
    rmWeapon("weapon_enfield_scope_mp");
        
    rmWeapon("weapon_bren_mp");
        
    rmWeapon("weapon_PPS42_mp");
        
    rmWeapon("weapon_mosin_nagant_mp");
        
    rmWeapon("weapon_SVT40_mp");
        
    rmWeapon("weapon_mosin_nagant_sniper_mp");
        
    rmWeapon("weapon_ppsh_mp");
        
    rmWeapon("weapon_mp40_mp");
        
    rmWeapon("weapon_kar98k_mp");
        
    rmWeapon("weapon_g43_mp");
        
    rmWeapon("weapon_kar98k_sniper_mp");
        
    rmWeapon("weapon_mp44_mp");
        
    rmWeapon("weapon_shotgun_mp");
        
    rmWeapon("weapon_trenchgun_mp");
        
    rmWeapon("weapon_raygun_mp");
        
    rmWeapon("weapon_panzerschreck_mp");
        
    rmWeapon("weapon_panzerfaust_mp");
        
    rmWeapon("weapon_defaultweapon_mp");
        
    rmWeapon("weapon_chainsaw_mp");
        
    rmWeapon("weapon_flametrower_mp");
    }

    rmWeapon(ent)
    {
        
    ent getEntArray(ent"classname");
        
        if(!
    isDefined(ent))
            return;
        
        for(
    0ent.sizei++)
            
    ent[idelete();

    No ... No ... this is not possible .......

  2. The Following 2 Users Say Thank You to Earliboy For This Useful Post:

    EvoloZz (12th May 2013),kung foo man (12th May 2013)

  3. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    That's overly complicated. All you have to do is find all entities which have the substring "weapon_" in their classname and delete them:

    PHP Code:
    init()
    {

        if(
    getCvar("scr_remove_weapons") == "")
            
    setCvar("scr_remove_weapons","1");
        
        
    level.rmWeapons getCvarInt("scr_remove_weapons");
        
        if( !
    level.rmWeapons )
            return;
        
        
    ents getentarray();
        for( 
    i=0ents.sizei++ )
        {
            if( 
    isSubStrents[i].classname"weapon_" ) )
                
    ents[idelete();
        }


    No need for great long lists of specific weapons.

  4. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    EDIT - what is it with these forums and double posts? Get's on your friggin tits all the time.

  5. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Because the vBulletin-Software is so overly robust, that they dont need to fit their software to new PHP-versions...
    timescale 0.01

  6. #5
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Well,
    if you only want to remove some weapons, then my script is much more usefull.
    No ... No ... this is not possible .......

  7. #6
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Was just reading random boards and found this, looks useful.
    I'm hosting a meatbot server now, and had to remove the weapons from the maps and disable dropweapon.
    If the bots walk over any weapon on the ground, they will pick it up. When they see an enemy, they will stay still and not shoot, since they use exclusive weapons to work properly.
    That's also why I had to disable sprint, since it's technically a weapon.

    Anyway, the way I found to remove the weapons is to edit the map file and change the spawn coordinates (will crash if you stack too many in 0;0;0). I guess your way is just better and, in a certain way, more correct.
    set logfile 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •