Author Topic: sniper zoom cod4  (Read 1349 times)

Offline MADJackson

  • Rank: Private
  • *
  • Posts: 37
sniper zoom cod4
« on: January 26, 2008, 08:00:57 am »
Hi all

This just an idea but is there a way to make a zoom scope by just updating the /adszoomfov/ for different zoom levels and adding a precached string for each level eg X4,X8 and X16.

When we played cod2 we had a zoom but it worked off 3 weapon files named _2_mp and _3_mp and to change zoom used the bash key.But as the zoom changed you bashed as well *L*

If it could be done by updating the zoomfov by some code it would all be serverside except the strings would it not ?.Thus keeping the download size smaller by not having the extra weapon files

Thoughts.....

Thanks
<MAD>Jackson

EDIT sorry posted in wrong section should have in suggestions

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
sniper zoom cod4
« Reply #1 on: January 26, 2008, 11:58:54 am »
Already a work in progress ;)

Offline MADJackson

  • Rank: Private
  • *
  • Posts: 37
sniper zoom cod4
« Reply #2 on: January 31, 2008, 01:27:19 pm »
Update...
I now have a working prototype of this still needs some text adding to say which level of zoom your at will do this with local strings or something and then a bit of testing.........
But it gives you four zoom levels at the moment x2,x4,x8,and x16 all by updating the adszoomfov/ / though script

Will let you know if i ever get it finished LOL

Offline Crypton

  • Rank: Private
  • *
  • Posts: 3
sniper zoom cod4
« Reply #3 on: February 25, 2008, 06:22:03 pm »
Just posting up a working script, have been working on a zoom script for my own setup, but thought I would share. Originally it was a small script that had a basic zoom I had gotten from a forum somewhere (fon't remember), but have modified it to allow me to set zooms per weapon so I am able to have different zoom depending on the weapon. (in this case as well I am tryin to get people to use other weapons besides the .50 :P)

Create a file named _ex_zoom.gsc
Add the following code

Code: [Select]

main() {
self endon("disconnect");
self endon("death");
self endon("joined_spectators");
issnipe = 0;
cur_p_weapon = self getCurrentWeapon();
switch(cur_p_weapon) {
case "m40a3_mp":
zoomlevel = 1;
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
issnipe = 1;
break;
case "m21_mp":
zoomlevel = 1;
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
issnipe = 1;
break;
case "dragunov_mp":
zoomlevel = 1;
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
issnipe = 1;
break;
case "remington700_mp":
zoomlevel = 1;
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
issnipe = 1;
break;
case "barrett_mp":
zoomlevel = 1;
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
issnipe = 1;
break;
default:
zoomlevel = 0;
issnipe = 0;
break;
} // End Switch Case
while(isAlive(self) && zoomlevel != 0) {
wait .05;
if (self playerADS() == 1) {
issnipe = IsSnipePlayerWeapon();
if (issnipe == 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;
} // End If Defined
self.hud_zoom setText(self.zoomtextstring);
if (self meleeButtonPressed()) {
zoomlevel++;
wait .25;
if (zoomlevel >= 4) {
zoomlevel = 1;
}
cur_p_weapon = self getCurrentWeapon();
if (cur_p_weapon == "m40a3_mp") {
if (zoomlevel == 1) {
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
}
if (zoomlevel == 2) {
self setclientDvar ("cg_fovmin", "20");
self.zoomtextstring = level.ex8xstring;
}
if (zoomlevel == 3) {
self setclientDvar ("cg_fovmin", "11");
self.zoomtextstring = level.ex16xstring;
}
issnipe = 1;
} else if (cur_p_weapon == "m21_mp") {
if (zoomlevel == 1) {
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
}
if (zoomlevel == 2) {
self setclientDvar ("cg_fovmin", "20");
self.zoomtextstring = level.ex8xstring;
}
if (zoomlevel == 3) {
self setclientDvar ("cg_fovmin", "3");
self.zoomtextstring = level.ex20xstring;
}
issnipe = 1;
} else if (cur_p_weapon == "dragunov_mp") {
if (zoomlevel == 1) {
self setclientDvar ("cg_fovmin", "20");
self.zoomtextstring = level.ex8xstring;
}
if (zoomlevel == 2) {
self setclientDvar ("cg_fovmin", "11");
self.zoomtextstring = level.ex16xstring;
}
if (zoomlevel == 3) {
self setclientDvar ("cg_fovmin", "3");
self.zoomtextstring = level.ex20xstring;
}
issnipe = 1;
} else if (cur_p_weapon == "remington700_mp") {
if (zoomlevel == 1) {
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
}
if (zoomlevel == 2) {
self setclientDvar ("cg_fovmin", "20");
self.zoomtextstring = level.ex8xstring;
}
if (zoomlevel == 3) {
self setclientDvar ("cg_fovmin", "11");
self.zoomtextstring = level.ex16xstring;
}
issnipe = 1;
} else if (cur_p_weapon == "barrett_mp") {
if (zoomlevel == 1) {
self setclientDvar ("cg_fovmin", "30");
self.zoomtextstring = level.ex4xstring;
}
if (zoomlevel == 2) {
self setclientDvar ("cg_fovmin", "20");
self.zoomtextstring = level.ex8xstring;
}
if (zoomlevel == 3) {
self setclientDvar ("cg_fovmin", "11");
self.zoomtextstring = level.ex16xstring;
}
issnipe = 1;
} else {
zoomlevel = 0;
issnipe = 0;
} // End If Cur Weapon
} // End ButtonPressed
} // End If Snipe
} // End ADS
if (isDefined(self.hud_zoom) && issnipe == 0) self.hud_zoom destroy();
if (isDefined(self.hud_zoom) && self playerADS() != 1) self.hud_zoom destroy();
} // End While
if (isDefined(self.hud_zoom) && self playerADS() != 1) self.hud_zoom destroy();
} // End Main

IsSnipePlayerWeapon() {
cur_p_weapon = self getCurrentWeapon();
if (cur_p_weapon == "m40a3_mp") {
issnipe = 1;
} else if (cur_p_weapon == "m21_mp") {
issnipe = 1;
} else if (cur_p_weapon == "dragunov_mp") {
issnipe = 1;
} else if (cur_p_weapon == "remington700_mp") {
issnipe = 1;
} else if (cur_p_weapon == "barrett_mp") {
issnipe = 1;
} else {
issnipe = 0;
}
return issnipe;
} // End IsSnipePlayerWeapon


In _ex_hud.gsc
Find:

Code: [Select]

if(isDefined(self.ex_modlogo)) self.ex_modlogo destroy();

After on a new line add:
Code: [Select]

// Zoom Hud Cleanup
if (isDefined(self.hud_zoom)) self.hud_zoom destroy();

In _ex_main.gsc
Find:

Code: [Select]

if(level.ex_campwarntime || level.ex_campsniper_warntime) self thread extreme\_ex_camper::campercheck()

After on a new line add
Code: [Select]

// Zoom Mod
self thread extreme\_ex_zoom::main();

In _ex_varcache
Add (anywhere in the middle)
Added mine above // Voting

Code: [Select]

// Zoom Strings
PrecacheString(&"2x");
PrecacheString(&"4x");
PrecacheString(&"6x");
PrecacheString(&"8x");
PrecacheString(&"10x");
PrecacheString(&"12x");
PrecacheString(&"14x");
PrecacheString(&"16x");
PrecacheString(&"18x");
PrecacheString(&"20x");
PrecacheString(&"22x");
PrecacheString(&"24x");
PrecacheString(&"26x");
PrecacheString(&"28x");
PrecacheString(&"30x");
PrecacheString(&"32x");

level.ex2xstring = &"2x";
level.ex4xstring = &"4x";
level.ex6xstring = &"6x";
level.ex8xstring = &"8x";
level.ex10xstring = &"10x";
level.ex12xstring = &"12x";
level.ex14xstring = &"14x";
level.ex16xstring = &"16x";
level.ex18xstring = &"18x";
level.ex20xstring = &"20x";
level.ex22xstring = &"22x";
level.ex24xstring = &"24x";
level.ex26xstring = &"26x";
level.ex28xstring = &"28x";
level.ex30xstring = &"30x";
level.ex32xstring = &"32x";


Not the greatest and my coding of course is odd at some points, but it was just something I had been messing with, once I get a version I like I will refine it and code it better, but for now, it works :)

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
sniper zoom cod4
« Reply #4 on: February 25, 2008, 06:28:37 pm »
We have had a Tut on this site for awhile now m8

You code looks just like what is here:
http://www.mycallofduty.com/modules.php?name=Forums&file=viewtopic&t=1757

Discusson on the Tut and code is here:
http://www.mycallofduty.com/modules.php?name=Forums&file=viewtopic&t=1788

Offline Crypton

  • Rank: Private
  • *
  • Posts: 3
sniper zoom cod4
« Reply #5 on: February 25, 2008, 06:44:24 pm »
that be the one, odd though I could not get on that site the other day at all. (ASP's site that is) I had posted there in their forum section and later that day went to check back an dhad gotten page not found then suspended :P glad to see it back up :)

Offline ASP-SniperOne

  • Rank: Private
  • *
  • Posts: 498
sniper zoom cod4
« Reply #6 on: February 25, 2008, 07:18:17 pm »
Yes our web site got hacked.  Not the main one (sentinal protected) but an old COD2 ultrastats install that has never been tops on security.  That stuff is gone and we are back in business.