this must be in g_local.h
void trycmdhelp (gentity_t *ent);
This section of code should be placed in g_cmds.c via void ClientCommand (int clientNum). Or you can write it in . Furthermore, you should to execute the command in void ClientCommand (int clientNum) place that.
else if (Q_stricmp (cmd, "cmdhelp") == 0 || Q_stricmp (cmd, "help") == 0 || Q_stricmp (cmd, "!?") == 0)
trycmdhelp (ent);
void trycmdhelp (gentity_t *ent){
int r = rand() % 3;
char cmd[MAX_TOKEN_CHARS];
FILE *f;
char s[1000];
char *contact;
trap_Argv( 0, cmd, sizeof( cmd ));
contact = "";
if (Q_stricmp(cmd, "cmdhelp") == 0 || Q_stricmp(cmd, "help") == 0 || Q_stricmp(cmd, "!?") == 0){
trap_SendServerCommand(ent-g_entities, va("print "^0|--------------^7Available ^3S4NDMoD ULT7M4T3 Game-Commands:^0-------------|n"));
trap_SendServerCommand(ent-g_entities, va("print "^0|^7Allways put ^5/ ^7before command ^0|n"));
trap_SendServerCommand(ent-g_entities, va("print "^0|^1/^5 ^7Example for you ^1/^5cmdhelp ^0|n"));
trap_SendServerCommand(ent-g_entities, va("print "^0|--------------------------------------------------------------------|n"));
f=S4ND_openf("cmd.txt","r");
if (r == 0){
contact = "@t MaxMusterMan@gmail.com";
trap_SendServerCommand(ent-g_entities, va("print "^3No cmd.txt found Contact %s!n",contact));
}else if (r == 1){
contact = "@t http://www.google.com";
trap_SendServerCommand(ent-g_entities, va("print "^3No cmd.txt found Contact %s!n",contact));
}else if (r == 2){
contact = "@t //rtcwpub.forumprofi.dehttp:/portal.php";
trap_SendServerCommand(ent-g_entities, va("print "^3No cmd.txt found Contact %s!n",contact));
}
else{
while (S4ND_fget(s,20,f)!=NULL){
trap_SendServerCommand(ent-g_entities, va("print"^0|^3%s",s));
}
trap_SendServerCommand(ent-g_entities, va("print "^0|^1Type: ^3? ^7?Help for more information^0|n"));
trap_SendServerCommand(ent-g_entities, va("print "^0|--------------------------------------------------------------------|n"));
S4ND_closef(f);
}
return;
}
}
This Code is just a matter of copy and paste from qboolean ConsoleCommand( void )
in g_svcmd.c
/*
if (Q_stricmp(cmd, "bannedips") == 0){
f=fopen("banned.txt","r");
if (!f)
G_Printf("no banned.txt foundn");
else{
while (fgets(s,20,f)!=NULL){
G_Printf("%s",s);
}
fclose(f);
}
return qtrue;
}
*/