| Author |
Topic: Code Help |
| Battosai~rb |
General Member Since: Dec 23, 2006 Posts: 105 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| ShoT~rb |
General Member Since: Dec 23, 2006 Posts: 24 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| RyanX~rb |
General Member Since: Dec 23, 2006 Posts: 625 Last: Dec 23, 2006 [view latest posts] |
|
|
|
Category: SoFII Mapping Posted: Saturday, Feb. 21, 2004 02:43 pm |
 |
if (Q_stricmp (cmd, "addadmin" ) == 0 ) { Svcmd_AddAdmin_f(); return qtrue; }
void Svcmd_AddAdmin_f( void ) { gentity_t *ent; int clientNum; char str1[MAX_TOKEN_CHARS];
if ( trap_Argc() < 2 ) { Com_Printf("Usage: AddAdmin <ID>\n"); return; }
trap_Argv( 1, str1, sizeof( str1 ) ); clientNum = atoi ( str1 ); ent = g_entities + clientNum;
if ( !isIDValid( clientNum ) ) { trap_SendServerCommand( ent->s.number, va("print \"Invalid client ID: %i\n\"", clientNum )); return; }
if ( ent->client->pers.connected == CON_CONNECTED ) { AddToUserFile( clientNum, "admin", "Admin" ); return; } }
void AddToUserFile( int clientNum, char *prefix, char *prefix2 ) { gentity_t *ent, *tent; char *name, *string, *ip, str1[MAX_TOKEN_CHARS], userinfo[MAX_INFO_STRING]; int lvlTime, msgTime; fileHandle_t f;
if ( trap_Argc() < 2 ) { return; }
lvlTime = level.time; msgTime = lvlTime + 5 * 1000; ent = g_entities + clientNum;
if ( ent->client->pers.connected == CON_CONNECTED ) { trap_GetUserinfo(ent->s.number, userinfo, sizeof(userinfo)); ip = Info_ValueForKey (userinfo, "ip"); name = ent->client->pers.cnetname;
trap_FS_FOpenFile( g_file.string, &f, FS_APPEND_TEXT ); if ( !f ) { Com_Printf( "WARNING: Cant open user file!\n" ); return; }
string = va("%s\n", IPFilter_FilterIP(ent, va("%s!%s",prefix,ip))); trap_FS_Write( string, strlen( string ), f ); trap_FS_FCloseFile( f );
if ( Q_stricmp ( prefix, "sadmin" ) == 0 ) { ent->client->sess.sadmin = qtrue; } if ( Q_stricmp ( prefix, "admin" ) == 0 ) { ent->client->sess.admin = qtrue; } if ( Q_stricmp ( prefix, "referee" ) == 0 ) { ent->client->sess.referee = qtrue; } if ( Q_stricmp ( prefix, "nokick" ) == 0 ) { ent->client->sess.nokick = qtrue; goto NOKICK; } if ( Q_stricmp ( prefix, "ban" ) == 0 || Q_stricmp ( prefix2, "ban" ) == 0 ) { ent->client->sess.ban = qtrue; return; }
trap_SetConfigstring ( CS_GAMETYPE_MESSAGE, va("%i,@^3%s^7 is now a %s", msgTime, name, prefix2 ) ); NOKICK:; trap_SetConfigstring ( CS_GAMETYPE_MESSAGE, va("%i,@^3%s^7 is now %s", msgTime, name, prefix2 ) ); Com_Printf( va("User %s added to file.\n", name ) ); GlobalSound("sound/misc/events/buzz02.wav"); return; } }
go play |
 |
|
|
| Battosai~rb |
General Member Since: Dec 23, 2006 Posts: 105 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| RyanX~rb |
General Member Since: Dec 23, 2006 Posts: 625 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| Battosai~rb |
General Member Since: Dec 23, 2006 Posts: 105 Last: Dec 23, 2006 [view latest posts] |
|
|
|
Category: SoFII Mapping Posted: Sunday, Feb. 22, 2004 03:21 am |
 |
hmm ok well ill play with it alittle but this all goes into svcmds right?, also if u can add me on msn mine is battosai106@hotmail.com, also do i have to add code in other files? like the header file G_local, i got rid of all the errors by deleting abunch of stuff but the only thing that works is when i type rcon addadmin it says usage addadmin id# but when i type addadmin 1 or 0 it just says addadmin and nothing more |
 |
|
|
| RyanX~rb |
General Member Since: Dec 23, 2006 Posts: 625 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| Battosai~rb |
General Member Since: Dec 23, 2006 Posts: 105 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| RyanX~rb |
General Member Since: Dec 23, 2006 Posts: 625 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
| RyanX~rb |
General Member Since: Dec 23, 2006 Posts: 625 Last: Dec 23, 2006 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|