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

Members Online

»
0 Active | 11 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 : Soldier of Fortune
Category: SoFII Scripting
Coding related issues dealing with Soldier of Fortune II.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: custom commands
CaSBoY
General Member
Since: Oct 15, 2004
Posts: 3
Last: Jan 7, 2005
[view latest posts]
Level 0
Category: SoFII Scripting
Posted: Saturday, Oct. 30, 2004 12:21 pm
does someone knows how to make custom commands and commands who print something in the console like OSP-command /command...thanks
Share |
gibbs
General Member
Since: Sep 8, 2004
Posts: 17
Last: Dec 19, 2004
[view latest posts]
Level 1
Category: SoFII Scripting
Posted: Sunday, Dec. 19, 2004 10:14 pm
Ok my post seems to be too long so let me cut it up lol

Code:
trap_SendServerCommand (ent-g_entities, va("print\"^4YOUR MESSAGE\n\""));



Right, it's a bit tricky, first of all you need commands. So in g_cmds.c search for: ClientCommand. Should bring you somewhere near the end of he file. Here are some of my admin commands, but them under the commented our stuff where ClientCommand is:
Share |
gibbs
General Member
Since: Sep 8, 2004
Posts: 17
Last: Dec 19, 2004
[view latest posts]
Level 1
Category: SoFII Scripting
Posted: Sunday, Dec. 19, 2004 10:16 pm
void AdminCommand (gentity_t *ent)
{
char command[MAX_TOKEN_CHARS];
char command2[MAX_TOKEN_CHARS];

trap_Argv(1, command, sizeof(command));
trap_Argv( 2, command2, sizeof( command2 ));

//explosion = trap_Cmd_RegisterEffect( "explosions/mushroom_explosion.efx" );


if (trap_Argc() < 2)
{

// HERE ARE THE COMMANDS FOR CONSOLE!

//list of cmds
trap_SendServerCommand (ent-g_entities, va("print\"^4============================\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^4| ^7Admin Commands \n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^4============================\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^5| e.g /adm broadcast hello\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| broadcast \n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| talk \n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| sas [Go North 200 Metres]\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| cof [Plays Music]\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| theater [Plays Music]\n\""));
trap_SendServerCommand (ent-g_entities, va("print\"^3| headshot [Headshot message/sound]\n\""));

// COMMANDS END

}

if (Q_stricmp(command, "broadcast")==0)
{
trap_SendServerCommand(-1,va("cp \"^-- ^,BROADCAST ^--\n" S_COLOR_WHITE "%s\"", ConcatArgs(2)));
G_Sound(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/ambience/airport/metal_detector.wav"));
return;
}

if (Q_stricmp(command, "solo")==0)
{
trap_SendServerCommand(-1,va("cp \"^-- ^,flick YEAH! ^--\n", ConcatArgs(2)));
G_Sound(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/music/holysolo.mp3"));
return;
}

else if (Q_stricmp(command, "talk")==0)
{
trap_SendServerCommand( -1, va("chat -1 \"^5*ADMIN^5*: %s\n\"", ConcatArgs(2)));
G_Sound(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/ambience/nyc/beep.mp3"));
return;
}
Share |
gibbs
General Member
Since: Sep 8, 2004
Posts: 17
Last: Dec 19, 2004
[view latest posts]
Level 1
Category: SoFII Scripting
Posted: Sunday, Dec. 19, 2004 10:19 pm
This forum doesnt like my code tags :|. Soz, right have a look at that and try to understand what im getting at, damn forums made things confusing.

The commands need something to reply from, so if you want them to reply for example "/adm" do this. At the bottom of the file above #ifdef _SOF2_BOTS enter this

Code:
  else if (Q_stricmp( cmd, "adm" ) == 0 )
AdminCommand(ent);

Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Soldier of Fortune : SoFII 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

»