diff options
author | Mikko Tiusanen <ams@daug.net> | 2014-10-16 23:57:28 +0300 |
---|---|---|
committer | Mikko Tiusanen <ams@daug.net> | 2014-10-16 23:57:28 +0300 |
commit | fac45098669b7516a26f7460d5ac4b9514423ee8 (patch) | |
tree | 0ced3b996256199a96c705cdaaac0189b3d5a7f7 /src/game/g_admin.c | |
parent | a0e9b32bebe33e33e34f7f51952c4d7b5406782e (diff) |
Fixed the cvar set issue after client disconnect.
Added support for setting player score through score_info.
Diffstat (limited to 'src/game/g_admin.c')
-rw-r--r-- | src/game/g_admin.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index d1ff924..5d11ac4 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -222,7 +222,7 @@ g_admin_cmd_t g_admin_cmds[ ] = {"score_info", G_admin_score_info, qtrue, "score_info", "display information about player's accumulated score", - "(^7name|slot#^7)" + "(^7name|slot#^7) [^7newscore^7]" }, {"setlevel", G_admin_setlevel, qfalse, "setlevel", @@ -3414,10 +3414,10 @@ qboolean G_admin_namelog( gentity_t *ent ) qboolean G_admin_score_info( gentity_t *ent ) { - int pid; - char name[ MAX_NAME_LENGTH ]; + char name[ MAX_NAME_LENGTH ]; g_admin_admin_t *target; - namelog_t *match; + namelog_t *match; + int newscore; if( trap_Argc() < 2 ) { @@ -3425,6 +3425,11 @@ qboolean G_admin_score_info( gentity_t *ent ) return qfalse; } + if( trap_Argc() > 2 ){ + trap_Argv( 2, name, sizeof( name ) ); + newscore = atoi( name ); + } + trap_Argv( 1, name, sizeof( name ) ); if( !( match = G_NamelogFromString( ent, name ) ) ) @@ -3439,10 +3444,22 @@ qboolean G_admin_score_info( gentity_t *ent ) return qfalse; } - ADMP( va( "score: ^7%s^7 level: %d score: %d\n", - match->name[match->nameOffset], - target->level, - target->score ) ); + if( trap_Argc() > 2 ) { + target->score = newscore; + admin_writeconfig(); + + admin_log( va("print \"^3score set: ^7%s^7 %d.\n\"", + target->guid, target->score ) ); + ADMP( va( "score set: ^7%s^7 level: %d score: %d\n", + match->name[match->nameOffset], + target->level, + target->score ) ); + } else { + ADMP( va( "score: ^7%s^7 level: %d score: %d\n", + match->name[match->nameOffset], + target->level, + target->score ) ); + } return qtrue; } |