The topic has been discussed but as far as I can find it has not been properly solved:
https://forums.alliedmods.net/showth...t=15962&page=2
If a CT is killed by the bomb, planter gets points.
If it is not possible to solve this for the common usage, maybe someone can get a solution that fits my needs:
On my server the bomb is planted straight away and the bomb is stripped from players, so who actually gets the + 3 points is not always the planter / defuser.
Because of this I'm trying to think of a way to strip 3 points from whoever gained 3 points from the last round.
I KNOW this is very very bad code but it explains what I'm trying to do so maybe someone could do it better:
PHP Code:
new g_playersWithFrags[33][2]
//This is called when bomb explodes:
public GetAllPlayersWithFrags()
{
new iPlayers[ 32 ] , iNum , id , iFrags;
get_players(iPlayers , iNum);
for (new i = 0 ; i < iNum ; i++)
{
id = iPlayers[i];
iFrags = get_user_frags(id);
g_playerWithFrags[id][0] = id;
g_playerWithFrags[id][1] = iFrags;
}
set_task(6.0, "RemoveThreeFrags");
}
//This is triggered by delay so someone got +3 points, who? Remove three points from whoever.
public RemoveThreeFrags()
{
new iPlayers[ 32 ] , iNum , id , iFrags;
get_players(iPlayers , iNum);
for (new i = 0 ; i < iNum ; i++)
{
id = iPlayers[i];
if (get_user_frags(id) == (g_playerWithFrags[id][1] + 3)) // This only works if I remove the "+ 3"
{
ExecuteHam(Ham_AddPoints, id, -3, true);
}
}
}
Sorry for this abomination and thanks for any help.
If someone could tell me why the comparison does not work that would atleast give me something that "works".