This functionality can be taken from the
GunGame plugin: addons/sourcemod/scripting/gungame_afk.sp
In the same way as was done in GunGame plugin.
Conditional example:
new Float:PlayerAfk[MAXPLAYERS+1][3];
public OnWar3EventSpawn(client)
{
GetEntDataVector(client, OffsetOrigin, PlayerAfk[client]);
}
public OnWar3WeaponFire(client)
{
PlayerAfk[client][0] += 500;
}
public OnWar3EventDeath(victim, attacker)
{
decl Float:Origin[3];
GetEntDataVector(victim, OffsetOrigin, Origin);
/* Basically by the time you get here the player drop approx about 55-60 units. So checking z now here is invalid. */
if (PlayerAfk[victim][0] == Origin[0] && PlayerAfk[victim][1] == Origin[1])
{
/* You killed an afk. */
War3_ChatMessage(attacker, "You do not gain xp/gold because you killed an afk");
// Anything else, such as AFK Deaths counter, move to observers, etc.
}
else
{
// Normal mode. Give XP/Gold, etc.
}
}