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

Members Online

»
0 Active | 48 Guests
Online:

LATEST FORUM THREADS

»
SOF2 Prefabs map
SoFII Mapping
coduo mapping tools
CoDUO Mapping
Gaming
Q4 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Forcing a dvar/cvar
darrenscerri
General Member
Since: Apr 6, 2007
Posts: 22
Last: Jun 11, 2007
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Apr. 6, 2007 01:38 pm
Hi, how can i write a mod which forces a dvar/cvar? i tried to add this code in the gametype files (dm.gsc, sd.gsc etc):
if (getCvar("cl_allowdownload") == "0"
setcvar("cl_allowdownload", "1");

nothing happnes...
Share |
MadBence
General Member
Since: Apr 15, 2005
Posts: 19
Last: May 2, 2007
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Apr. 6, 2007 02:41 pm
darrenscerri writes...
Quote:
Hi, how can i write a mod which forces a dvar/cvar? i tried to add this code in the gametype files (dm.gsc, sd.gsc etc):
if (getCvar("cl_allowdownload") == "0"
setcvar("cl_allowdownload", "1");

nothing happnes...

Try this (always force the cvar)
Code:

Callback_PlayerConnect()
{
thread dummy();
//bla-bla, here is original code
self setclientcvar("cl_allowdownload", "1");
}

This code ALWAYS forces the cvar! (When player connects)
Share |
darrenscerri
General Member
Since: Apr 6, 2007
Posts: 22
Last: Jun 11, 2007
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Apr. 7, 2007 06:02 am
thanks for your response.... il try it out asap
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Apr. 11, 2007 08:10 am
setcvar and getcvar operate on the server.
setclientcvar operates on a client.

And there's no getclientcvar function, unfortunately.
Share |
toggle
General Member
Since: Dec 11, 2004
Posts: 27
Last: Feb 23, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Wednesday, Apr. 11, 2007 12:14 pm
You can check a client cvar when they connect..

PlayerConnect()

if(getcvar("cl_allowDownload") != "1")

//if it isnt set to "1" ..then,

self setClientCvar("cl_allowdownload", "1");

//sets the client Cvar appropriately.

This new client setting would now be read on the next map rotation.
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Apr. 11, 2007 01:58 pm
toggle writes...
Quote:
You can check a client cvar when they connect..

PlayerConnect()

if(getcvar("cl_allowDownload") != "1")

//if it isnt set to "1" ..then,

self setClientCvar("cl_allowdownload", "1");

//sets the client Cvar appropriately.

This new client setting would now be read on the next map rotation.

No, because getcvar returns the dvar value on the server, not the client.
As I said, there is no function to read a client dvar.
Share |
darrenscerri
General Member
Since: Apr 6, 2007
Posts: 22
Last: Jun 11, 2007
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Apr. 17, 2007 10:27 am
This is confusing :S what should i do to force downloads? Note: they cannot download the mod which forces the downloads if they still have downloads off... it must be server-sided.
Share |
nedgerblansky
General Member
Since: Jan 28, 2005
Posts: 57
Last: Nov 9, 2007
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Apr. 17, 2007 01:04 pm
You can't.
Man, this question has been asked a thousand times...

You can force the client dvar, but only when the player has connected at least once.
And if he has connected without downloading, the problem remains.
Share |
toggle
General Member
Since: Dec 11, 2004
Posts: 27
Last: Feb 23, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Tuesday, Apr. 17, 2007 01:41 pm
Yes Nedgerblansky is correct,i apologise for confusing the matter.

The Admiral Mod has a workaround to this problem,by using a transparent texture that is downloaded to the client.If the client does not download the texture upon connect,they will get a default missing texture error ..a checkerboard pattern which the client cannot see through.

Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»