Page 1 of 1
Is it possible to make no weapons in hands when ...
Posted: Thu Jun 26, 2003 4:00 am
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.
Posted: Thu Jun 26, 2003 4:13 am
by Alcoholic
maybe $player take all will work dont know.
Posted: Thu Jun 26, 2003 4:51 am
by mohaa_rox
i don't think $player is defined in MP, try local.player
Posted: Thu Jun 26, 2003 8:39 am
by Parts
$player takeall
This will do what you want
Posted: Thu Jun 26, 2003 11:32 am
by mohaa_rox
oh cool

Posted: Thu Jun 26, 2003 11:51 am
by nuggets
won't that remove everyones weapons as every ingame is $player, they're each distinguishable only by their array
Posted: Fri Jun 27, 2003 1:14 am
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
Posted: Fri Jun 27, 2003 1:34 am
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.
Posted: Fri Jun 27, 2003 7:50 am
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
Posted: Fri Jun 27, 2003 9:10 am
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
Posted: Fri Jun 27, 2003 10:14 am
by mohaa_rox
omg another nuggets.

Posted: Fri Jun 27, 2003 1:23 pm
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 .
Posted: Fri Jun 27, 2003 11:24 pm
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