Sniper only?

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 »



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 »

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 »

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 »

When they respawn, they'll get the weapon they chose anyway.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

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 »

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. ;)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
XenoPHoXx_NL
Sergeant
Posts: 53
Joined: Thu Feb 16, 2006 11:26 pm
Contact:

Post by XenoPHoXx_NL »

can't you just download the mod foloowing the next link and see how it was done?

http://www.moaclan.com/modules.php?name ... ostPopular
Can't Win The Game? Change The Rules!
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

XenoPHoXx_NL wrote:can't you just download the mod foloowing the next link and see how it was done?

http://www.moaclan.com/modules.php?name ... ostPopular
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 »

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.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

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

Code: Select all

case x:    // stuff    
               break;
and the else bracket needs to be there otherwise you'll get syntax errors.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply