I'm trying to make it so that when the round is manually restarted the stats reset, but also so that when the round starts the stats reset too, and it's working, but I'm still getting the errors. -.-
Code:
new bool:gSet[33];
new gStats[8];
new gBodyhits[8];
public plugin_init()
{
register_plugin("Set Stats", "1.6", "Satan")
register_event("ResetHUD", "round", "be")
register_event("TextMsg", "event_game_will_restart", "a", "2=#Game_will_restart_in")
register_logevent("new_round", 2 , "1=Round_Start");
register_logevent("MyFuncRoundStart", 2, "0=World triggered", "1=Round_Start")
}
//-------------------------------------------------------------------
public client_connect(id)
{
gSet[id] = false
}
//-------------------------------------------------------------------
public new_round()
{
set_task(0.1, "set_stats")
}
//-------------------------------------------------------------------
public round(id)
{
set_task(0.1, "set_stats", id)
}
//-------------------------------------------------------------------
public event_game_will_restart()
{
set_task(0.1, "set_stats")
}
//-------------------------------------------------------------------
public MyFuncRoundStart()
{
set_task(0.1, "set_stats")
}
//-------------------------------------------------------------------
public set_stats(id)
{
get_user_stats(id, gStats, gBodyhits)
new kills = get_user_frags(id)
new timesdied = get_user_deaths(id)
new frags = gStats[0]
new deaths = gStats[1]
if(!gSet[id] && frags != kills || deaths != timesdied)
{
set_user_frags(id, frags) // this line here
cs_set_user_deaths(id, deaths);
gSet[id] = true;
}
return PLUGIN_CONTINUE
}
I don't know why it would work, but there's no bugs with the plugin (with the exception of the runtime error).
L 03/12/2006 - 10:11:42: [AMXX] Displaying debug trace (plugin "setstats.amxx")
L 03/12/2006 - 10:11:42: [AMXX] Run time error 10: native error (native "set_user_frags")
L 03/12/2006 - 10:11:42: [AMXX] [0] php0KsT1q.sma::set_stats (line 78)