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

Members Online

»
0 Active | 7 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: Server Messages...
cod4guy
General Member
Since: Dec 28, 2007
Posts: 3
Last: Jun 24, 2008
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Thursday, Apr. 10, 2008 09:15 pm
How do I integrate server adverts into my mod? Like I want to have messages at the bottom right saying "Visit our website".
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Apr. 10, 2008 09:50 pm
This is typically done as a hud element. You would have to add it to some where in your mod's scripts.

Code:

	if(!isdefined(self.website))
	{
		self.website = newClientHudElem(self); // tell it to make a new hud element
		self.website.archived = false;
		self.website.x = 320; //Hud position X
		self.website.y = 40; //Hud position Y
		self.website.alignX = "center"; //align to the X axis
		self.website.alignY = "middle"; //align to the Y axis
		self.website.sort = 1; // force to draw after the bars
		self.website.fontScale = 3.5;
	}
	self.website setText(&"LOCALIZATION_FILE"); //This is what text to show using a localization file or inline text.


Try something like that...
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
exsolvedh3
General Member
Since: Jan 23, 2008
Posts: 18
Last: Jul 9, 2008
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Friday, Apr. 11, 2008 04:39 am
Oh, thanks for that code, was looking for that. Just a quick question though, what I the hud's size? So that we can position text correctly. Like if it is 100 units wide, using self.website.x = 50; would place the text at center?

Thankyou.
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 11, 2008 07:12 am
HUD dimensions things are on a 640x480 grid

this is one that i use, fades in and out between 2 word, and only needs to be called up at the start of loading all the scripts instead for each player

Code:
<br />
showlogo()<br />
{<br />
	level notify("stop_logo"); // just in case it gets called up twice<br />
	level endon("stop_logo");<br />
<br />
	if(isDefined(level.logoText)) // if it was called up twice, then destroy the old one<br />
		level.logoText destroy();<br />
<br />
	level.logoText = newHudElem(); // make new HUD element for all players and players that may come on<br />
	level.logoText.x = 480;<br />
	level.logoText.y = 470;<br />
	level.logoText.alignX = "center";<br />
	level.logoText.alignY = "middle";<br />
	level.logoText.alpha = 0;<br />
	level.logoText.sort = 15;<br />
	level.logoText.fontScale = 1.4; // the smallest fontscale is 1.4... which isnt very small ):<br />
	level.logoText.archieved = true;<br />
<br />
	for(;;)<br />
	{<br />
		level.logoText fadeOverTime(1);<br />
		level.logoText.alpha = 1;<br />
		level.logoText setText("^5Freeze Tag By ^1KiLL3R ^5v1.3");<br />
		wait 5;<br />
		level.logoText fadeOverTime(1);<br />
		level.logoText.alpha = 0;<br />
		wait 1;<br />
		level.logoText fadeOverTime(1);<br />
		level.logoText.alpha = 1;<br />
		level.logoText setText("^1Xfire: ^2zak4000");<br />
		wait 5;<br />
		level.logoText fadeOverTime(1);<br />
		level.logoText.alpha = 0;<br />
		wait 1;<br />
	}<br />
}<br />
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Friday, Apr. 11, 2008 09:22 pm
Wait killer... what do you mean by only needs to be called up at the start of loading all the scripts instead for each player... It isn't going to loop so how are all of the players going to see it if it isn't called up for each player? Yes your way is more efficient, but I don't see how it is not going to be called for each player... is there something I don't understand?
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 11, 2008 09:30 pm
newHudElem()
goes on everyones screen all the time (including players that may connect later)

newTeamHudElem(team)
only goes on the set team, "allies", "axis" or "spectator" all the time (including players that may connect later and join that team)

newClientHudElem(player)
only goes on player (of course, in this case they have to be actually on the server at the time)

when i say all the time, that is until the HUD element destroyed or something

edited on Apr. 11, 2008 05:32 pm by .KiLL3R.
Share |
cod4guy
General Member
Since: Dec 28, 2007
Posts: 3
Last: Jun 24, 2008
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Saturday, Apr. 12, 2008 12:53 am
Woot KiLL3R. Thx. Did you know I was gonna post this? lololol.
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

»