From 1a77a8eeeabc30acfcd2856f5205eebc5f9a98e0 Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 13 May 2004 18:40:01 +0000 Subject: [PATCH] Tomaz's nametime patch (prevent frequent name changes on the server) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4158 d7cf8633-e32d-0410-b094-e92efae38249 --- host_cmd.c | 10 ++++++++-- server.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/host_cmd.c b/host_cmd.c index b5d43ffe..645a6a18 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -686,14 +686,20 @@ void Host_Name_f (void) if (cmd_source == src_command) { - if (strcmp(cl_name.string, newName) == 0) - return; Cvar_Set ("_cl_name", newName); if (cls.state == ca_connected) Cmd_ForwardToServer (); return; } + if (sv.time < host_client->nametime) + { + SV_ClientPrintf("You can't change name more than once every 5 seconds!\n"); + return; + } + + host_client->nametime = sv.time + 5; + if (strcmp(host_client->name, newName) && host_client->name[0] && strcmp(host_client->name, "unconnected")) SV_BroadcastPrintf("%s changed name to %s\n", host_client->name, newName); strcpy(host_client->name, newName); diff --git a/server.h b/server.h index e520b600..5ae03a23 100644 --- a/server.h +++ b/server.h @@ -149,6 +149,10 @@ typedef struct client_s // visibility state float visibletime[MAX_EDICTS]; + + // prevent animated names + float nametime; + #ifdef QUAKEENTITIES // delta compression state float nextfullupdate[MAX_EDICTS]; -- 2.39.2