Adding Server-Side Commands
Warning: This post may contain nerdy or geeky talk, you have been warned!
Hi,
Well I'm a little confused at the moment!
I am in a crazed attempt trying to add an extra command to bitfighter, it looked fairly easy when I started.. But I was wrong, oh so wrong!
I figured to add my command for testing purposes, to simply print text (hello world!) all I would need to modify was these files:
This semi works. BUT. Only when I also add the command to the client as-well does it work.
Older clients cannot use the new command I figured this is where gameType.cpp stepped in and forwarded stuff
(for example old clients, don't got /addbot, but yet can use it)
But I appear to have been wrong, oh so wrong.
I gathered what I needed to modify by various google code changelogs. But I seem to be missing something!
So I am here to ask you.. what have I done wrong? . Modified code can be found below .
UIGame.cpp: Line 1660
UIGame.h: Line 330
gameType.cpp: Lines 2853 through 2866
So, my question is quite simple. What am I missing?
PS: I'm not a pro c++ programmer in anyway what-so-ever I'm kinda making it up as I go along and seeing if it compiles lmao.
Hi,
Well I'm a little confused at the moment!
I am in a crazed attempt trying to add an extra command to bitfighter, it looked fairly easy when I started.. But I was wrong, oh so wrong!
I figured to add my command for testing purposes, to simply print text (hello world!) all I would need to modify was these files:
- UIGame.cpp
- UIGame.h
- gameType.cpp
This semi works. BUT. Only when I also add the command to the client as-well does it work.
Older clients cannot use the new command I figured this is where gameType.cpp stepped in and forwarded stuff
(for example old clients, don't got /addbot, but yet can use it)
But I appear to have been wrong, oh so wrong.
I gathered what I needed to modify by various google code changelogs. But I seem to be missing something!
So I am here to ask you.. what have I done wrong? . Modified code can be found below .
UIGame.cpp: Line 1660
UIGame.h: Line 330
gameType.cpp: Lines 2853 through 2866
- Code:
- else if(!stricmp(cmd, "mycommand"))
{
if(!clientRef->clientConnection->isAdmin())
clientRef->clientConnection->s2cDisplayMessage(GameConnection::ColorRed, SFXNone, "!!! You don't have permission to");
else
{
clientRef->clientConnection->s2cDisplayMessage(GameConnection::ColorRed, SFXNone, "!!! Hello World !!!");
}
}
else
{
// Command not found, tell the client
clientRef->clientConnection->s2cDisplayMessage(GameConnection::ColorRed, SFXNone, "!!! Invalid Command");
}
So, my question is quite simple. What am I missing?
PS: I'm not a pro c++ programmer in anyway what-so-ever I'm kinda making it up as I go along and seeing if it compiles lmao.