Is it possible to make no weapons in hands when ...

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Eversun
Lance Corporal
Posts: 18
Joined: Sat Jun 14, 2003 11:47 am

Is it possible to make no weapons in hands when ...

Post by Eversun »

Is it possible to make no weapons in hands when players enter the game?

I mean they have no weapons on hand when they joined the game, they only can pick up the weapons I set on the ground, is it possible?

Thank you.
Last edited by Eversun on Thu Jun 26, 2003 4:13 am, edited 1 time in total.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

maybe $player take all will work dont know.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

i don't think $player is defined in MP, try local.player
Live to map, not map to live.
-mohaa_rox, .map
moderator
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Post by Parts »

$player takeall

This will do what you want
[VS-UK]Capt.Parts[BnHQ]
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

oh cool :oops:
Live to map, not map to live.
-mohaa_rox, .map
moderator
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

won't that remove everyones weapons as every ingame is $player, they're each distinguishable only by their array
hope this helps, prob not cos it's all foreign 2 me :-/
Desert Eagle
Captain
Posts: 237
Joined: Mon Jan 13, 2003 1:05 am
Location: Mapping Bunker
Contact:

Post by Desert Eagle »

Any command in a multiplayer with a $player attatched affects every player in the game.

I have played around with $player in mulitplayer, and it effects everyone, using some sort of if dmteam allies or axis will effect just that team. I do not know the script exactly, but it can be set up to take away one side or the others. I have been playing around with some way to just take the allies weapons myself for a prison escape map. If I get it working right, I will post it
Desert-Eagle
....The Eagle Has Landed...
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

I'm noob but try this:

if($player[1])
$player[1] takeall

I THINK this will remove only the weapns of player 1 ( the first player to join. If you want, just repeat the line changing the [1] for [2] and so on...

Not guarantee to work, just trying to help.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

don't know if using if($player[]) command is a real command, but using the for loop would solve your problem, repeating that line up to 64 times would be a pain in the ass

for (local.i = 1; local.i < 65; local.i++)
if ($player[local.i])
$player[local.i] takeall
hope this helps, prob not cos it's all foreign 2 me :-/
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Post by Parts »

yes doing $player takeall will remove weapons from all players. This is what he asked for though isn't it?

Alternativly you could loop through the players and remove them individually. In fact because there is a delay between the map starting and the players weapons being loaded out it is sometimes better to do this. Here's a script I put together for a similar purpose.

The following script uses several user defined CVARS. It allows anyone who has rcon to configure a specific weapons only mode by setting a cvar to 1. So someone could type RCON <password> set rifleonly 1 in console and then every player would be loaded out with a bolt action rifle. Note this script was written for spearhead, I have no idea if it works in MOHAA

Code: Select all

//Script that assigns players weapons after they join a team
//could change it to be randomised or something


Start:

//level waittill spawn
level waittill roundstart
	
//First set up an array of 44 to store the players status
for (local.i = 1; local.i <= 44; local.i++)
{
	level.PlayerGunsReplace[local.i] = 0
}


//Set this server variable to 1 to clear all the others!
local.AllWeapons = getcvar(AllWeapons)

local.RifleOnly = getcvar(RifleOnly)	
local.PistolOnly = getcvar(PistolOnly)
local.SilencedOnly = getcvar(SilencedOnly)
local.SniperOnly = getcvar(SniperOnly)
local.SMGOnly = getcvar(SMGOnly)
local.MGOnly = getcvar(MGOnly)
local.RocketOnly = getcvar(RocketOnly)

if (local.AllWeapons == "1")
{
	setcvar RifleOnly "0"
	setcvar PistolOnly "0"
	setcvar SilencedOnly "0"
	setcvar SniperOnly "0"
	setcvar SMGOnly "0"
	setcvar MGOnly "0"
	setcvar RocketOnly "0"

	setcvar AllWeapons "0"
	
	
	end
}


if ( (local.RifleOnly == "1") || (local.PistolOnly == "1") || (local.SilencedOnly == "1") || (local.SniperOnly == "1") || (local.SMGOnly == "1") || (local.MGOnly == "1") || (local.RocketOnly == "1") )
{

	RepeatTest:

	

		//Array initialised now loop
		for (local.y = 1; local.y <= $player.size; local.y++)
		{
			if (level.PlayerGunsReplace[local.y] == 0)
			{

				if ( isalive($player[local.y]) && ($player[local.y].health > 0) )
				{
				
					if ( ( $player[local.y].dmteam == axis ) || ( $player[local.y].dmteam == allies ) )
					{
						level.PlayerGunsReplace[local.y] = 1
						if (local.RifleOnly == "1") 
							thread GiveRifle $player[local.y]
						else if (local.PistolOnly == "1")
							thread GivePistolOnly $player[local.y]
						else if (local.SilencedOnly == "1")
							thread GiveSilencedOnly $player[local.y]
						else if (local.SniperOnly == "1")
							thread GiveSniper $player[local.y]
						else if (local.SMGOnly == "1")
							thread GiveSMG $player[local.y]
						else if (local.MGOnly == "1")
							thread GiveMG $player[local.y]
						else if (local.RocketOnly == "1")
							thread GiveRocket $player[local.y]
					
					}
				}
			}
		}
	
		wait 1
		goto RepeatTest

}

end

LoadAxisOther local.player:
	local.player item models/weapons/steilhandgranate.tik
	local.player ammo grenade 1
	local.player item models/weapons/nebelhandgranate.tik
	local.player ammo smokegrenade 1
end

LoadAlliedOther local.player:
	local.player  item models/weapons/mills_grenade.tik
	local.player  ammo grenade 1
	local.player  item models/weapons/M18_smoke_grenade.tik
	local.player  ammo smokegrenade 1
end

GiveRifle local.player:
	wait 0.5
	local.player takeall

	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
		local.player item models/weapons/kar98.tik	
		waitthread LoadAxisOther local.player
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
		local.player item models/weapons/enfield.tik
		waitthread LoadAlliedOther local.player	
	}
	local.player useweaponclass "rifle"
	local.player iprint "You have been given a bolt action rifle"
end

GivePistolOnly local.player:
	wait 0.5
	local.player takeall
	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
	}

	local.player useweaponclass "pistol"
	local.player iprint "You have been given a pistol only"
end


GiveSilencedOnly local.player:
	wait 0.5
	local.player takeall
	local.player item models/weapons/silencedpistol.tik
	local.player useweaponclass "pistol"
	local.player iprint "You have been given a silenced pistol only"
end

GiveSniper local.player:
	wait 0.5
	local.player takeall

	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
		local.player item models/weapons/KAR98sniper.tik	
		waitthread LoadAxisOther local.player
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
		local.player item models/weapons/springfield.tik
		waitthread LoadAlliedOther local.player	
	}
	local.player useweaponclass "rifle"
	local.player iprint "You have been given a sniper rifle"
end


GiveSMG local.player:
	wait 0.5
	local.player takeall

	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
		local.player item models/weapons/mp40.tik	
		waitthread LoadAxisOther local.player
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
		local.player item models/weapons/sten.tik
		waitthread LoadAlliedOther local.player	
	}
	local.player useweaponclass "smg"
	local.player iprint "You have been given an SMG"
end

GiveMG local.player:
	wait 0.5
	local.player takeall

	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
		local.player item models/weapons/mp44.tik	
		waitthread LoadAxisOther local.player
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
		local.player item models/weapons/bar.tik
		waitthread LoadAlliedOther local.player	
	}
	local.player useweaponclass "mg"
	local.player iprint "You have been given a Machine Gun"
end

GiveRocket local.player:
	wait 0.5
	local.player takeall

	if (local.player.dmteam == axis)
	{
		local.player item models/weapons/p38.tik
		local.player item models/weapons/panzerschreck.tik	
		waitthread LoadAxisOther local.player
	}
	else
	{
		local.player item models/weapons/Webley_Revolver.tik
		local.player item models/weapons/bazooka.tik
		waitthread LoadAlliedOther local.player	
	}
	local.player useweaponclass "heavy"
	local.player iprint "You have been given a rocket launcher"
end
[VS-UK]Capt.Parts[BnHQ]
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

omg another nuggets. :lol:
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Yes seems a bit long I am sure you can do it with less lines but I can see how it works . Can't you use 1 cvar sort of like a mode cvar and set it to the mode you want .
Desert Eagle
Captain
Posts: 237
Joined: Mon Jan 13, 2003 1:05 am
Location: Mapping Bunker
Contact:

Post by Desert Eagle »

Would this work script?

//look for allied player take weapon

for (self.i = 1; self.i <= 32; self.i++)
{
if ($player[self.i])
{
if ($player[self.i].dmteam == allies)
{
$player[self.i] takeall
}
}
}
end
Desert-Eagle
....The Eagle Has Landed...
Post Reply