Author Topic: Discussion: Zoom Sniper Scope  (Read 13390 times)

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #60 on: April 09, 2008, 09:38:21 pm »
ok i will try that,, not trying to rush you sorry if i gave that impression, i quess i did ask before lol duh me mind is weak  :cry:

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #61 on: April 09, 2008, 09:53:36 pm »
*L* No worries m8

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #62 on: April 10, 2008, 06:39:55 pm »
nope it not change anything . bummer but i quess i can live with 2 - 6 zooms.
i did notice it was here so i changed them both , but had the same effect

 self setclientDvar ("cg_fovmin", "??"); // Replace ?? with the original value of cg_fovmin, which I can't check on at this moment.
break;
}
if (hasRifle == 1)

{
if (zoom == 0)
{
zoom = 2;
} self setclientDvar ("cg_fovmin", "20");

Offline ASP-SniperOne

  • Rank: Private
  • *
  • Posts: 498
Discussion: Zoom Sniper Scope
« Reply #63 on: April 10, 2008, 11:04:52 pm »
comic.

delete the following lines

if (zoom == 0)
{
zoom = 2;
self setclientDvar ("cg_fovmin", "20");
}


change the following
switch (zoom)
{
case 1:
self setclientDvar ("cg_fovmin", "40");
self playlocalsound("mouse_click");
break;
case 2:
self setclientDvar ("cg_fovmin", "20");
self playlocalsound("mouse_click");
break;
case 3:
self setclientDvar ("cg_fovmin", "15");
self playlocalsound("mouse_click");
break;
case 4:
self setclientDvar ("cg_fovmin", "10");
self playlocalsound("mouse_click");
break;
case 5:
self setclientDvar ("cg_fovmin", "5");
self playlocalsound("mouse_click");
break;
case 6:
self setclientDvar ("cg_fovmin", "3");
self playlocalsound("mouse_click");
break;
default:
zoom = 1;
break;


to this

switch (zoom)
{
case 1:
self setclientDvar ("cg_fovmin", "40");
self playlocalsound("mouse_click");
break;
case 2:
self setclientDvar ("cg_fovmin", "20");
self playlocalsound("mouse_click");
break;
case 3:
self setclientDvar ("cg_fovmin", "15");
self playlocalsound("mouse_click");
break;
case 4:
self setclientDvar ("cg_fovmin", "10");
self playlocalsound("mouse_click");
break;
case 5:
self setclientDvar ("cg_fovmin", "5");
self playlocalsound("mouse_click");
break;
case 6:
self setclientDvar ("cg_fovmin", "3");
self playlocalsound("mouse_click");
break;
default:
zoom = 0;  // this is the line I changed
break;


give that a go.

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #64 on: April 11, 2008, 02:09:19 pm »
THANK YOU SNIPERONE  that did it,, well the "6" zoom goes to "0" with no change ,but then "1" start's it out.NICE,, oh and silly me the sound does work, just not very loud, sorry for the hassle Joker,and ty for your patience.

Offline ASP-SniperOne

  • Rank: Private
  • *
  • Posts: 498
Discussion: Zoom Sniper Scope
« Reply #65 on: April 11, 2008, 03:54:49 pm »
hey comic.

post your new code and I will fix it better.

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #66 on: April 11, 2008, 04:03:02 pm »
OK


main()  
{
  self  endon("disconnect");  
  self  endon("death");  
  self  endon("joined_spectators");
 
  hasRifle = 0;
  zoom = 0;

  while (isAlive( self ))
  {
    switch(self getCurrentWeapon())
    {
      case  "m21_mp":
        hasRifle  =  1;
        break;

      case  "barrett_mp":
        hasRifle  =  1;
        break;
     
      case  "dragunov_mp":
        hasRifle  =  1;
        break;
     
      case  "m40a3_mp":
        hasRifle  =  1;
        break;
         
      case  "remington700_mp":
        hasRifle  =  1;
        break;
         
      default:
        hasRifle  =  0;
        zoom = 0;
        self  setclientDvar ("cg_fovmin", "60"); // Replace ?? with the original value of cg_fovmin, which I can't check on at this moment.
        break;
      }
    if (hasRifle == 1)
   
   {
       
      while (self playerADS() == 1)
      {          
        if (!isdefined(self.hud_zoom))
        {
          self.hud_zoom  =  newClientHudElem(self);
          self.hud_zoom.x  =  320;
          self.hud_zoom.y  =  450;
          self.hud_zoom.alignx  =  "center";
          self.hud_zoom.aligny  =  "middle";
          self.hud_zoom.horzAlign  =  "fullscreen";
          self.hud_zoom.vertAlign  =  "fullscreen";
          self.hud_zoom.alpha  =  .9;
          self.hud_zoom.fontScale  =  2;
          self.hud_zoom.label  =  &"zoom_x^3";  //comment  this  out  if  you  do  not  have  localized  strings  defined  here
          self.hud_zoom  setvalue(zoom);
        }

        if (self  meleeButtonPressed())  
        {  
          zoom++;
        wait .2;
          switch (zoom)
          {
            case 1:
              self  setclientDvar  ("cg_fovmin",  "40");
           self playlocalsound("mouse_click");
              break;
            case 2:
              self  setclientDvar  ("cg_fovmin",  "20");
           self playlocalsound("mouse_click");
              break;
            case 3:
              self  setclientDvar  ("cg_fovmin",  "15");
           self playlocalsound("mouse_click");
              break;
            case 4:
              self  setclientDvar  ("cg_fovmin",  "10");
           self playlocalsound("mouse_click");
              break;
            case 5:
              self  setclientDvar  ("cg_fovmin",  "5");
           self playlocalsound("mouse_click");
              break;
            case 6:
              self  setclientDvar  ("cg_fovmin",  "3");
           self playlocalsound("mouse_click");
              break;
         default:
           zoom = 0;
           break;
         
          }
          self.hud_zoom  setvalue(zoom);
        }
        wait .05;
      }
      }
    if (isDefined(self.hud_zoom)) self.hud_zoom destroy();
    wait .05;
  }
}





I did change this line per joker'.........self  setclientDvar ("cg_fovmin", "60"); // Replace ?? with the original value of cg_fovmin, which I can't check on at this moment.

i replaced the ?? with 60...."cg_fovmin", "60");

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #67 on: April 11, 2008, 04:34:15 pm »
Hey S1 -- slap the ACOG rifles in there too ;)

Offline ASP-SniperOne

  • Rank: Private
  • *
  • Posts: 498
Discussion: Zoom Sniper Scope
« Reply #68 on: April 11, 2008, 05:14:29 pm »
comic.

give this a try.  it should cover droping and picking up weapons.

Code: [Select]
main()
{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");

zoom = 0;
old_weap= 0;

while (isAlive( self ))
{
wait .05;
switch(self getCurrentWeapon())
{
case "m21_mp":
hasRifle = 1;
if (old_weap != 1)
{
old_weap= 1;
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
}
break;

case "barrett_mp":
hasRifle = 1;
if (old_weap != 2)
{
old_weap= 2;
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
}
break;

case "dragunov_mp":
hasRifle = 1;
if (old_weap != 3)
{
old_weap= 3;
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
}
break;  

case "m40a3_mp":
hasRifle = 1;
if (old_weap != 4)
{
old_weap= 4;
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
}
break;

case "remington700_mp":
hasRifle = 1;
if (old_weap != 5)
{
old_weap= 5;
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
}
break;

default:  
hasRifle = 0;
if (old_weap != 6)
{
old_weap= 6;
zoom = 3;
self setclientDvar ("cg_fovmin", "60"); //this should be set to what you want for your other weapons
}
break;
}
if (hasRifle == 1)
{
while (self playerADS() == 1)
{
if (!isdefined(self.hud_zoom))
{
self.hud_zoom = newClientHudElem(self);
self.hud_zoom.x = 320;
self.hud_zoom.y = 450;
self.hud_zoom.alignx = "center";
self.hud_zoom.aligny = "middle";
self.hud_zoom.horzAlign = "fullscreen";
self.hud_zoom.vertAlign = "fullscreen";
self.hud_zoom.alpha = .9;
self.hud_zoom.fontScale = 2;
self.hud_zoom.label = &"zoom_x^3"; //comment this out if you do not have localized strings defined here
self.hud_zoom setvalue(zoom);
}
if (self meleeButtonPressed())
{
zoom++;
if(zoom > 6) zoom = 1;
wait .2;
switch (zoom)
{
case 1:
self setclientDvar ("cg_fovmin", "40");
self playlocalsound("mouse_click");
break;
case 2:
self setclientDvar ("cg_fovmin", "20");
self playlocalsound("mouse_click");
break;
case 3:
self setclientDvar ("cg_fovmin", "15");
self playlocalsound("mouse_click");
break;
case 4:
self setclientDvar ("cg_fovmin", "10");
self playlocalsound("mouse_click");
break;
case 5:
self setclientDvar ("cg_fovmin", "5");
self playlocalsound("mouse_click");
break;
case 6:
self setclientDvar ("cg_fovmin", "3");
self playlocalsound("mouse_click");
break;
default:
break;
}
self.hud_zoom setvalue(zoom);
}
}
}
if (isDefined(self.hud_zoom)) self.hud_zoom destroy();
wait .05;
}
}

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #69 on: April 11, 2008, 07:32:41 pm »
thanks Sniper  but it wont change zoom now????it stuck on "3"   sorry if i becoming a hassle  :oops:

Offline ASP-SniperOne

  • Rank: Private
  • *
  • Posts: 498
Discussion: Zoom Sniper Scope
« Reply #70 on: April 12, 2008, 07:10:12 am »
you know.  I loaded it up and also get only 3.  I guess I need to look at it  better.  I'll get it for you today

Offline comic

  • Rank: Private
  • *
  • Posts: 48
Discussion: Zoom Sniper Scope
« Reply #71 on: April 12, 2008, 11:15:38 am »
ok thanks and happy hunting

Offline TheSaint

  • Rank: Private
  • *
  • Posts: 215
    • http://www.cogamingclan.com
Discussion: Zoom Sniper Scope
« Reply #72 on: April 13, 2008, 01:05:00 am »
~

you should be all set now Comic

~

Offline OT_R1

  • Rank: Private
  • *
  • Posts: 1
Discussion: Zoom Sniper Scope
« Reply #73 on: June 16, 2008, 04:58:08 am »
Hi all,

I'm kinda new at game programming, so i'll already apologize for my noobish question ;-)

Is it possible to assign the zoom in/out button to another button/function then the standard functions that come with cod4?  

attackButtonPressed()   -- left mouse button
fragButtonPressed() -- g button
secondaryOffhandButtonPressed()  -- 4 button
meleeButtonPressed() -- v button

A better question could be; is it possible to create our own Function so that you can assign it to another function button? The reason for this question is that i already use all the standard buttons/functions!

Hope to here from you soon!

Greetz OT_R1