Rage through 32 single player levels and 6 deathmatch levels of sheer terror and fully immersive sound and lighting. Arm yourself against the cannibalistic Ogre, fiendish Vore and indestructible Schambler using lethal nails, fierce Thunderbolts and abominable Rocket and Grenade Launchers.

Report article RSS Feed Quake c - server and client controls

Quake c has built in functions to send server and client commands, stuffcmd and localcmd - Not a trivial task and needed for complex mods. This tutorial will help.

Posted by numbersix on Sep 10th, 2011
Advanced Server Side Coding.

For reference: Cataboligne.org we will be looking at the section of the quake c manual at that link.  You can make a local copy - I did a scroogle search and couldnt even find it.  (There are other manuals, but that is my favorite.)

These are the two quake c instructions referenced:

stuffcmd (entity client, string text);

client = player that is to receive the command

text = text of the command, ended by \n (newline).

Send a command to a given player, as if it had been typed on the player's
console. Don't forget the \n (newline) at the end, otherwise your command
will not be executed, and will stand still on the console window.


localcmd (string text);

text = text of the command, ended by \n (newline).

Execute a command on the server, as if it had been typed on the server's console.

*** Important NOTE: these two pieces of code are not interchangeable!

The first - stuffcmd - is used to send console commands to a client connected to the server.  There are any number of variables server code might want to change, however, the most frequent use is "bf\n" - flash the screen.

The second - localcmd - tends to be used for code controlled server admin type functions such as loading new maps, and changing control vars.

In both cases the engine interprets the text as if typed and a terminator <\n> char MUST be sent, or the command will languish in the console buffer.

This segment is something for the coder to keep in mind - I just ran into this during development.  There is a .cfg file that gets executed based on in game action.  And it wasnt working for the network client.  I checked and sure enough, I had threw in localcmd when I wanted stuffcmd.

Post comment Comments
ArkaZeen
ArkaZeen Sep 11 2011, 11:03am says:

thanks for the help! :)

+1 vote     reply to comment
numbersix
numbersix Sep 12 2011, 11:02am replied:

Your welcome. I literally just ran into this again.

+1 vote     reply to comment
numbersix
numbersix Sep 29 2013, 8:03pm says:

Quake-c Manual ver 3.4 entry for commands:

8.8 Server managment

Function: stuffcmd

stuffcmd (entity client, string text)
client = player that is to receive the command
text = text of the command, ended by \n (newline).
Send a command to a given player, as if it had been typed on the player's console.
Don't forget the \n (newline) at the end, otherwise your command will not be executed, and will stand still on the console window.

8.10 Console

Function: localcmd

void localcmd (string text)
text = text of the command, ended by \n (newline).
Execute a command on the server, as if it had been typed on the server's console.
Examples:

localcmd("restart\n"); // restart the level
localcmd("teamplay 1\n"); // set deathmatch mode to teamplay
localcmd("killserver\n"); // poor server...

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Quake
Platforms
Windows, Mac, Linux, DOS, N64, DC
Developer & Publisher
id Software
Engine
Quake Engine
Contact
Send Message
Official Page
Idsoftware.com
Release Date
Released Jun 18, 1996
Game Watch
Track this game
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Games
Quake
Quake Single & Multiplayer First Person Shooter
Related Engines
DarkPlaces engine
DarkPlaces engine GPL Released Mar 30, 2000
Quake Engine
Quake Engine GPL Released Jun 22, 1996
Related Groups
Dark Places engine team
Dark Places engine team Developer with 15 members
id Software
id Software Developer & Publisher
qc
qc Hardware & Tech group with 26 members
QuakeDB
QuakeDB Fans & Clans group with 137 members