Page 1 of 1
Knife Only Map
Posted: August 29th, 2012, 6:38 am
by J.Octavian
Hi, I attempted to read the scripting tutorial posted here, because I'm attempting to keep players from shooting in a custom Knife Only map, and I cannot wrap my head around any of it. I was wondering if someone could simply tell me how to disable all weapons just in one map, so all they'd have to use is the knife. Any help would be appreciated.
Re: Knife Only Map
Posted: August 29th, 2012, 11:13 am
by Goro92
try TakeAllWeapons() or DisableWeapons()
check this website:
http://www.zeroy.com/script/
Re: Knife Only Map
Posted: August 29th, 2012, 11:58 am
by J.Octavian
I know nothing about scripting, and all I got from that site was
level.player TakeAllWeapons();
I have no idea what to do with it. Putting it into my mp_mymap.gsc gave me a script runtime error saying undefined is not an entity.
Re: Knife Only Map
Posted: August 29th, 2012, 12:06 pm
by Rezil
You have to get all the players, either by waiting until a player connects or getting the array of player entities(getEntArray("player", "classname")). Only then can you call takeAllWeapons() on the player.
Re: Knife Only Map
Posted: August 29th, 2012, 12:10 pm
by J.Octavian
Ok so how would I take all weapons from the players as they spawn into my map?
Re: Knife Only Map
Posted: August 29th, 2012, 4:20 pm
by F |Madness| U
Code: Select all
onPlayerSpawned() //everything in this function happens to each player when they spawn
{
    self waittill("spawned_player");   Â
    self TakeAllWeapons(); //should remove all weapons
    self giveWeapon ( "knife_mp" );
    self giveWeapon( "usp_mp" ); // gives them a usp and a knife
    self setWeaponAmmoClip("usp_mp", 0);
    self setWeaponAmmoStock("usp_mp", 0); // removes ammo from the usp so they cannot fire
    self switchtoweapon("usp_mp"); //switches to the usp, let the fun begin (hopefully)
}
These functions work for Black Ops, I am assuming they are all present in CoD4 also. I only gave them the usp because 1) I'm not sure if you can knife if you arn't holding a weapon and 2) many players simply like holding a gun whilst knifing.
Re: Knife Only Map
Posted: August 30th, 2012, 2:37 am
by J.Octavian
This doesn't work. I keep getting "script compile error bad syntax { "