void VM_CustomStats_Clear(void);
void VM_SV_UpdateCustomStats(client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats);
-
+void SV_Name(int clientnum);
void SV_InitOperatorCommands(void);
void SV_Savegame_to(prvm_prog_t *prog, const char *name);
}
}
+void SV_Name(int clientnum)
+{
+ prvm_prog_t *prog = SVVM_prog;
+ PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
+ if (strcmp(host_client->old_name, host_client->name))
+ {
+ if (host_client->begun)
+ SV_BroadcastPrintf("\003%s ^7changed name to ^3%s\n", host_client->old_name, host_client->name);
+ strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
+ // send notification to all clients
+ MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
+ MSG_WriteByte (&sv.reliable_datagram, clientnum);
+ MSG_WriteString (&sv.reliable_datagram, host_client->name);
+ SV_WriteNetnameIntoDemo(host_client);
+ }
+}
+
/*
======================
SV_Name_f
*/
static void SV_Name_f(cmd_state_t *cmd)
{
- prvm_prog_t *prog = SVVM_prog;
int i, j;
qboolean valid_colors;
const char *newNameSource;
if (j >= 0 && strlen(host_client->name) < sizeof(host_client->name) - 2)
memcpy(host_client->name + strlen(host_client->name), STRING_COLOR_DEFAULT_STR, strlen(STRING_COLOR_DEFAULT_STR) + 1);
- PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
- if (strcmp(host_client->old_name, host_client->name))
- {
- if (host_client->begun)
- SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name);
- strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
- // send notification to all clients
- MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
- MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
- MSG_WriteString (&sv.reliable_datagram, host_client->name);
- SV_WriteNetnameIntoDemo(host_client);
- }
+ SV_Name(host_client - svs.clients);
}
static void SV_Rate_f(cmd_state_t *cmd)
//strlcpy (host_client->name, name, sizeof (host_client->name));
if (name != host_client->name) // prevent buffer overlap SIGABRT on Mac OSX
strlcpy (host_client->name, name, sizeof (host_client->name));
- PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
- if (strcmp(host_client->old_name, host_client->name))
- {
- if (host_client->begun)
- SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name);
- strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
- // send notification to all clients
- MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
- MSG_WriteByte (&sv.reliable_datagram, i);
- MSG_WriteString (&sv.reliable_datagram, host_client->name);
- SV_WriteNetnameIntoDemo(host_client);
- }
+ SV_Name(i);
// DP_SV_CLIENTCOLORS
host_client->colors = (int)PRVM_serveredictfloat(host_client->edict, clientcolors);