Knife Only Map
Moderator: Core Staff
-
- CJ Wannabe
- Posts: 4
- Joined: August 29th, 2012, 6:34 am
Knife Only Map
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.
-
- CJ Wannabe
- Posts: 4
- Joined: August 29th, 2012, 6:34 am
Re: Knife Only Map
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.
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.
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: Knife Only Map
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.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
- CJ Wannabe
- Posts: 4
- Joined: August 29th, 2012, 6:34 am
Re: Knife Only Map
Ok so how would I take all weapons from the players as they spawn into my map?
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: Knife Only Map
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)
}
-
-
- CJ Wannabe
- Posts: 4
- Joined: August 29th, 2012, 6:34 am
Re: Knife Only Map
This doesn't work. I keep getting "script compile error bad syntax { "
Who is online
Users browsing this forum: No registered users and 2 guests