Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 8 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Zoom Script
SSGD
General Member
Since: May 29, 2007
Posts: 4
Last: Feb 15, 2008
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Feb. 12, 2008 04:46 am
Hi Guy's We have our Zoom working (6 zoom steps) extreme Zoom for COD4 set to use the V key however, when the zoom is used by the V key , our zoom skips from 1-4 and some times 1-5 Zoom instead of 1-2-3-4-5-6 with each click. But if we assign V as the mouse scroll wheel then the zoom will work correctly. We are using the extreme mod.. If you need to see the script I would be happy to post it... In hopes someone has come up against this problem in the past with any zoom function.

Thanks for any help in advance
We be Stuck lol.
SSG.D
Share |
HarkoninVSC
General Member
Since: Jan 25, 2008
Posts: 294
Last: Apr 24, 2008
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Tuesday, Feb. 12, 2008 10:13 pm
Can you post the script so we can see if there are any errors.
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Tuesday, Feb. 12, 2008 10:30 pm
Maybe V is a repeating button, but the mouse scroll is one at a time or something...yeah, we need the script [tongue]
Share |
SSGD
General Member
Since: May 29, 2007
Posts: 4
Last: Feb 15, 2008
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Friday, Feb. 15, 2008 05:58 pm
NovemberDobby writes...
Quote:
Maybe V is a repeating button, but the mouse scroll is one at a time or something...yeah, we need the script [tongue]
Thanks guy's. There are 3 .gsc files

1st: _ex_zoom.gsc
main()

{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");

switch( self getCurrentWeapon() )
{
case "m21_mp":
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
break;

case "barrett_mp":
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
break;

case "dragunov_mp":
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
break;

case "m40a3_mp":
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
break;

case "remington700_mp":
zoom = 3;
self setclientDvar ("cg_fovmin", "15");
break;

default:
zoom = 0;
break;
}

while(isAlive( self ) && zoom != 0)
{
wait .05;

if ( 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 = &"{A.S.B.P}_ZOOM_X"; //comment this out if you do not have localized strings defined here
self.hud_zoom setvalue(zoom);

if ( self meleeButtonPressed())
{
zoom++;

if (zoom == 7) zoom = 1;

if (zoom == 1) self setclientDvar ("cg_fovmin", "40");
if (zoom == 2) self setclientDvar ("cg_fovmin", "20");
if (zoom == 3) self setclientDvar ("cg_fovmin", "15");
if (zoom == 4) self setclientDvar ("cg_fovmin", "10");
if (zoom == 5) self setclientDvar ("cg_fovmin", "5");
if (zoom == 6) self setclientDvar ("cg_fovmin", "3");
}
}

if(isDefined(self.hud_zoom) && self playerADS() != 1 ) self.hud_zoom destroy();
}
}

If you don't see the fauld here I will show the other two:
Thanks guy's[banghead]
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Friday, Feb. 15, 2008 06:13 pm
Try replacing:

if ( self meleeButtonPressed())
{
zoom++;

if (zoom == 7) zoom = 1;

if (zoom == 1) self setclientDvar ("cg_fovmin", "40");
if (zoom == 2) self setclientDvar ("cg_fovmin", "20");
if (zoom == 3) self setclientDvar ("cg_fovmin", "15");
if (zoom == 4) self setclientDvar ("cg_fovmin", "10");
if (zoom == 5) self setclientDvar ("cg_fovmin", "5");
if (zoom == 6) self setclientDvar ("cg_fovmin", "3");
}
}

if(isDefined(self.hud_zoom) && self playerADS() != 1 ) self.hud_zoom destroy();
}
}

with:

Code:

if ( self meleeButtonPressed()) 
{ 
wait 0.1;
zoom++; 

if (zoom == 7) zoom = 1; 

if (zoom == 1) self setclientDvar ("cg_fovmin", "40"); 
else if (zoom == 2) self setclientDvar ("cg_fovmin", "20"); 
else if (zoom == 3) self setclientDvar ("cg_fovmin", "15"); 
else if (zoom == 4) self setclientDvar ("cg_fovmin", "10"); 
else if (zoom == 5) self setclientDvar ("cg_fovmin", "5"); 
else if (zoom == 6) self setclientDvar ("cg_fovmin", "3"); 
} 
} 

if(isDefined(self.hud_zoom) && self playerADS() != 1 ) self.hud_zoom destroy(); 
} 
}
Share |
{A2K}vettevictor
General Member
Since: May 8, 2007
Posts: 89
Last: Feb 9, 2010
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Wednesday, Feb. 20, 2008 01:52 pm
hello
iam abit new at this i understand the scripting only i can't find where to place it.
iam running a custom extreme sniper mod 3 mods in 1 i made it but really would like to have the zoom.
thanks
greets
Share |
Shoot
General Member
Since: Jun 22, 2002
Posts: 260
Last: Mar 22, 2008
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Saturday, Mar. 22, 2008 04:07 am
Adding a longer wait works well too - keeps it from reacting too quick.

I use a: wait 0.6;

Gives time for the scope to react and for the player to see the change.
Share |
BurningCross
General Member
Since: Jan 26, 2008
Posts: 33
Last: Apr 24, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Saturday, Mar. 22, 2008 05:18 pm
I think that a boolen variable is definitely the best choice.
Something like that:

Code:

flag=false;
if ( self meleeButtonPressed() && !flag){
flag = true;
...
//the rest of the code
...
}else{
flag=false; 
}  


so the player must press and release the melee button every time to get the zoom increment, doesn't matter how long he will press it.

;)

edited on Mar. 22, 2008 01:19 pm by BurningCross
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Saturday, Mar. 22, 2008 05:33 pm
There's a neat thing I discovered how to do:

while(1)
{
wait 0.05;

//stuff

while(self meleebuttonpressed()) wait 0.05;
}

So once they've pressed it, it waits until they've let go.
Share |
OT_R1
General Member
Since: Jun 16, 2008
Posts: 2
Last: Jun 16, 2008
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Monday, Jun. 16, 2008 11:59 am
Hi all,

I'm really new at this, can you tell me if it is possible to use another button then melee? I mean like assiging to button 3 instead of melee.

something like;
while(self buttonpressed("BUTTON_3")) wait 0.05;

cause i tried the above option, but can't get it to work?
assigning to fragbuttonpressed and so on does work;
Can you only assign these things to a function?
Is it then possible to create a function myself?

Hope i made myslef clear. Thanx in advance

Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»