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

Members Online

»
0 Active | 85 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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: Enabling developer mode and debug messages
kstolen
General Member
Since: Jul 3, 2012
Posts: 3
Last: Jul 3, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 11:50 am
Hi guys, I'm performing a non-conventional style of modding - editing the .gsc files in server memory. This allows the server to be somewhat modded (like setting which perks are allowed, for example), while remaining ranked and on the unmodded server list.

There are many debug messages scattered throughout the gsc files. They're commented out, but uncommenting does nothing. How can I view these debug messages in the console and how can I make my own?

I'd like to create an admin helper panel/menu, that let server admins peform common tasks like kicking/banning etc easily.

Is this sort of thing possible with gsc? Can chat events be intercepted? What about getting player stats - like their IP/GUID/slot number?

Is there any documentation on gsc syntax and libraries?
Share |
Tremolo4
General Member
Since: Mar 16, 2012
Posts: 7
Last: Mar 26, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 01:11 pm
That is unconventional indeed, but cool ;)

You can (still) find the official included functions documentation here. I am not aware of any complete syntax doc or code feature list (like bit shifting operators, function callbacks); I learned almost everything from other mod-scripts myself.
You could take a look at this wiki.

Some functions only work in script-developer/debug mode (set dvar "developer_script" to 1) but that in turn disables getting XP, challenges etc. Theres also the dvar "developer" but I'm not sure about its purpose... Other functions, like openfile(), have been removed from the "production" cod4 version.

You can't create/edit menus with .gsc code. However you could mess around with the NewClientHudElem function and create some hud elements that look like a menu using the AttackButtonPressed(), UseButtonPressed() etc. functions for user input. I've seen that on some servers, so I know that it works, but I haven't really figured out how to get hud elements working myself. Handling the "menu" using only the buttons that have ButtonPressed-functions also takes much getting used to.. well, good luck ;)

Chat events can not be intercepted with script functions (gsc), but messages are stored in the server-logfile (games_mp.log), so you could use an external daemon like BigBrotherBot or ManuAdminMod..

You can't find out a player's IP with a script function (correct me if I'm wrong). As for the rest, I've made you a little code snippet:

Code:

// get all player entities in an array
players = GetEntArray("player", "classname");

for (i = 0; i < players.size; i++) {
  // get the current player's GUID
  guid = players[i] GetGuid();

  // get the current player's slot number
  num = players[i] GetEntityNumber();

  // maybe do something with them? ;)

  // kick the player
  Kick(num);

  // ban the player
  Ban(num);

}
Share |
kstolen
General Member
Since: Jul 3, 2012
Posts: 3
Last: Jul 3, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 03:06 pm
Thanks, those are some really useful resources!

That's unfortunate that the IP of a player can't be found through the scripts - it's the only way of semi-reliable authentication that springs to mind unless custom cvars can be read from a player through scripts. GUID unfortunately is not so good on cracked servers :P

I'd love to have a server-side admin mod, without having to use something that has to parse the chatlogs.

If chat events could be intercepted, it would allow me to add mute commands or perhaps other new commands easily. Otherwise I'd have to hook a whole bunch of functions, which is a lot of work.

Are there any mods that in particular that you'd recommend I take a look at and learn from?

edited on Jul. 3, 2012 08:07 am by kstolen
Share |
Tremolo4
General Member
Since: Mar 16, 2012
Posts: 7
Last: Mar 26, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 04:41 pm
If your server uses PunkBuster, take a look at its (the pbsv.so module's, I think) memory. You can find a client-hardware-based UUID in there ;) I know someone who made an authentication system based on that UUID for his cracked servers. He hooked quite a few (other) game engine functions (including chat-related stuff) as well and sent me his C source code and his modified executable. He told me that he plans to release his work to the public some day; I'll notify you then ;)

Client cvars CAN be read via script, with a special menu, but as I said you can't create menus without recompiling the mod (because the raw menu files get compiled). I think nobody made a decompiler for menus (yet).

If you don't have the CoD4 ModTools already, get them and take a look at the original cod4 scripts in the cod4/raw/maps/mp/ directory, the earliest cod4 modders learned scripting that way ;)
You could of course also just extract them from zone//common_mp.ff or from memory (blablabla, apparently you already did that).
FastFiles (ff) are just deflated; you can find an extraction tool for those files here.

When I'm interested in a mod I just extract the .gsc files from the mod.ff using that tool and, well, read them through ;)
I can't really split the mods I know into categorys like well written and badly written.. but here are some:
Obscurity
PromodLive (up to v2.04, the newer ones have obfuscated script code)
Reign of the Undead (this one doesn't use any of Infinity Wards script, it's a complete rewrite opposed to most other mods. It also has a lot of code, partly because it has an AI algorithm for bot-zombies)
zom_db
DeathRun

At first you should probably look through the ModsRepository Wiki; there should be some (very) basic scripting tutorial(s).

You could also add me on Xfire (tremolo4) and ask questions, I'm glad to help ;) or just ask them here.
Share |
kstolen
General Member
Since: Jul 3, 2012
Posts: 3
Last: Jul 3, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 05:08 pm
No PB unfortunately, but it's not completely out of the question at a future stage.

I know a guy that sounds very similar...his name begins with a c and ends in a 0. Same guy?

Anyway, thanks again Tremolo, you've been very helpful. I'm gonna go see what I can do :)

Share |
Tremolo4
General Member
Since: Mar 16, 2012
Posts: 7
Last: Mar 26, 2014
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jul. 3, 2012 05:11 pm
Nope, that's not him.

No problem :)
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

»