An Aus

#1

RE: Programming

in Mod's and Maps 16.12.2017 22:41
von medicine man | 57 Beiträge

Place this in g_cmds.c
/*
*@ Cmd_currentTime_f
*/

Quelle Source : http://z4.invisionfree.com/ProgrammingAn...dex.php?act=idx
extern int trap_RealTime ( qtime_t * qtime );
const char *aMonths[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
void Cmd_CurrentTime_f( gentity_t *ent ) {
qtime_t ct;
trap_RealTime(&ct);

trap_SendServerCommand(-1, va("chat "%s^7: The current time is: ^3%02d:%02d:%02d (^7%02d %s %d^3) n"",
ent->client->pers.netname ,
ct.tm_hour,
ct.tm_min,
ct.tm_sec,
ct.tm_mday,
aMonths[ct.tm_mon],
1900+ct.tm_year ) );
}
Place this in g_local.h under g_cmds.c
void Cmd_CurrentTime_f( gentity_t *ent );

Place this in g_cmds.c void ClientCommand( int clientNum )
if (Q_stricmp (cmd, "time") == 0)
Cmd_CurrentTime_f (ent);

You need for windows the Microsoft Visual Studio 2005/2008/2010 or higher.

nach oben springen

#2

RE: Programming

in Mod's and Maps 29.12.2017 21:03
von medicine man | 57 Beiträge

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;
}
*/

nach oben springen


Besucher
0 Mitglieder und 1 Gast sind Online

Forum Statistiken
Das Forum hat 29 Themen und 95 Beiträge.

Heute waren 0 Mitglieder Online: