Post your scripting questions / solutions here
Moderator: Moderators
Habsey
Lance Corporal
Posts: 14 Joined: Wed Mar 22, 2006 7:05 am
Location: Canada.
Contact:
Post
by Habsey » Thu Mar 23, 2006 7:17 pm
lol try this
Code: Select all
while(1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
local.myteam = $player[local.i].dmteam
if!($player[local.i].fix)
{
if ($player[local.i].dmteam == "axis")
{
$player[local.i] takeall
$player[local.i] item weapons/kar98sniper.tik
$player[local.i].fix = 1
}
if ($player[local.i].dmteam == "allies")
{
$player[local.i] takeall
$player[local.i] item weapons/springfield.tik
$player[local.i].fix = 1
}
}
else
{
if($player[local.i].dmteam != local.myteam || (!(isalive $player[local.i])))
{
$player[local.i].fix = NIL
}
}
}
waitframe
}
Elgan
Lieutenant General
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Thu Mar 23, 2006 7:43 pm
local.myteam = $player[local.i].dmteam
will always be the same, unless its changed inless than the frame;)
Habsey
Lance Corporal
Posts: 14 Joined: Wed Mar 22, 2006 7:05 am
Location: Canada.
Contact:
Post
by Habsey » Thu Mar 23, 2006 8:04 pm
Elgan wrote: local.myteam = $player[local.i].dmteam
will always be the same, unless its changed inless than the frame;)
meh
here
lol
Code: Select all
while(1)
{
local.myteam = $player.dmteam
waitframe
}
while(1)
{
for(local.i=1;local.i<=$player.size;local.i++)
{
if!($player[local.i].fix)
{
if ($player[local.i].dmteam == "axis")
{
$player[local.i] takeall
$player[local.i] item weapons/kar98sniper.tik
$player[local.i].fix = 1
}
if ($player[local.i].dmteam == "allies")
{
$player[local.i] takeall
$player[local.i] item weapons/springfield.tik
$player[local.i].fix = 1
}
}
else
{
if($player[local.i].dmteam != local.myteam || (!(isalive $player[local.i])))
{
$player[local.i].fix = NIL
}
}
}
waitframe
}
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Thu Mar 23, 2006 8:18 pm
When they respawn, they'll get the weapon they chose anyway.
Barttje
Sergeant Major
Posts: 111 Joined: Sat Aug 20, 2005 8:52 pm
Post
by Barttje » Thu Mar 23, 2006 8:46 pm
Rookie One.pl wrote: When they respawn, they'll get the weapon they chose anyway.
how can i stop that?
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Thu Mar 23, 2006 9:32 pm
Use a script with proper spawn and death detection.
AP's weapon limiter might really be a good choice. At least download it and see how it's done there.
Barttje
Sergeant Major
Posts: 111 Joined: Sat Aug 20, 2005 8:52 pm
Post
by Barttje » Fri Mar 24, 2006 1:56 pm
That's the way I did it before, but now ive 2 maps and in one map Sniper-only and the other map All-weapons... :S
Green Beret
Major General
Posts: 746 Joined: Mon Apr 19, 2004 12:21 pm
Contact:
Post
by Green Beret » Fri Mar 24, 2006 5:33 pm
I think your switch statements need tweaked, jus edit to your liking.
Code: Select all
local.mapname = getcvar(mapname)
switch local.mapname
{
case "dm/mohdm1":
thread Sniper_only
break
case "dm/mohdm2":
break
I had a simular problem, And found a bit of code on the forums and added it to my script, and it worked perfect.
Code: Select all
local.mod2 = (int(getcvar dm2))
if(local.mod2 == 0 || local.mod2 == NIL)
exec maps/dm/mohdm2_v1.scr //stock
else
//{//not sure u need these lines?
//switch(local.mod2)
{
case 1:
exec maps/dm/mohdm2_2.scr;break //your modded .scr with sniper only
case 2:
exec maps/dm/mohdm2_3.scr;break //your modded .scr with bla bla
case 3:
exec maps/dm/mohdm2_4.scr;break //your modded .scr another mod
case 4:
exec maps/dm/mohdm2_1.scr;break //your modded .scr bla bla
}
local.mod2++
if(local.mod2 > 4)
local.mod2 = 1
setcvar mod2 local.mod2
}
Just make a .scr named mohdm2_2.scr with the sniper only script.
lizardkid
Windows Zealot
Posts: 3672 Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT
Post
by lizardkid » Fri Mar 24, 2006 6:24 pm
yes you need those lines.
Code: Select all
else
{//not sure u need these lines?
switch(local.mod2)
switch is a command to test multiple cases at once, it's where you need
and the else bracket needs to be there otherwise you'll get syntax errors.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006