Has anyone used this before? I just now noticed it and it seems kind of useful:
Code:
H_COMMAND(util_playerstate, "")
{
if (g_Engine->Cmd_Argc() < 2)
{
META_CONPRINT("Usage: <entity index>\n");
return;
}
int index = Q_atoi(g_Engine->Cmd_Argv(1));
if (index < 0 ||index >= g_Engine->GetEntityCount())
{
META_CONPRINT("Specified index is higher than entity count! (Or below zero!)\n");
}
edict_t* entity = g_Engine->PEntityOfEntIndex(index);
if (!entity)
{
META_CONPRINT("Got NULL edict_t*!\n");
return;
}
CPlayerState* state = g_ServerGameClients->GetPlayerState(entity);
if (!state)
{
META_CONPRINT("Got NULL CPlayerState*!\n");
return;
}
META_CONPRINTF("deadflag:\t%d\n"
"v_angle:\t%f %f %f\n"
"netname:\t%s\n"
"fixangle:\t%d\n"
"anglechange:\t%f %f %f\n"
"hltv:\t%d\n"
"frags:\t%d\n"
"deaths:\t%d\n", state->deadflag ? 1 : 0, state->v_angle.x, state->v_angle.y,
state->v_angle.z, state->netname.ToCStr(), state->fixangle,
state->anglechange.x, state->anglechange.y, state->anglechange.z,
state->hltv ? 1 : 0, state->frags, state->deaths);
}
Gives me:
Code:
util_playerstate 1
deadflag: 0
v_angle: 0.000000 90.000000 0.000000
netname:
fixangle: 0
anglechange: 0.000000 0.000000 0.000000
hltv: 0
frags: -1
deaths: 1
I'm not sure if the deadflag is set when the player is starting to die or is done dying though. Everything else seems to work nicely, though netname seems to be unused.
Edit: World seems to have a CPlayerState instance with unitialized gibberish. Be careful with that.
Edit #2: Editing the data has no effect on anything. I guess this is purely for fast information access.