Setting negative score/frag to the player just won't work with either set_user_frags or Ham_AddPoints way.
Doing it with Ham_AddPoints sets the player's score back to 0 (using a plugin which force the score to not go to a negative value), doesn't matter how high score the player had. And without checking the user frags, it crash the server instantly when the event gets called.
Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
new g_maxplayers
#define IsPlayer(%1) (1 <= %1 <= g_maxplayers)
public plugin_init()
{
register_event("TextMsg", "HookHostageKilled", "b", "2&#Killed_Hostage")
g_maxplayers = get_maxplayers()
}
public HookHostageKilled(id)
{
if(IsPlayer(id))
{
// ExecuteHamB(Ham_AddPoints, id, -2, true) // server crash instantly
// The killer/player's score is set to 0 even if the killer/player have 2+ score
if(get_user_frags(id) >= 2)
ExecuteHamB(Ham_AddPoints, id, -2, true)
else if(get_user_frags(id) == 1)
ExecuteHamB(Ham_AddPoints, id, -1, true)
}
}