hi,
i'm writing a plugin to put a mini live status to db.
now i have a problem to delete users stats in db when he left the server.
now i want to ask is there a way to delete users data without a loop to see who is not anymore on the server?
i tried :
on client connect
PHP Code:
public Load_SQL(id)
{
new steam_id[33],Temp[512],name[33],loss,ping
/*team :
0 = connecting
1 = spectating
2 = Catcher
3 = Fleer
*/
get_user_ping(id,ping,loss)
get_user_authid(id, steam_id, charsmax(steam_id))
get_user_name(id,name,32)
if (equal(steam_id,"ID_PENDING"))
{
return PLUGIN_HANDLED
}
format(Temp,charsmax(Temp),"INSERT INTO `catch_live` ( `authid` , `name` , `Score` , `Deaths` , `Ping` , `speed` , `Maxspeed` , `fps` , `team` , `ag` , `map`)VALUES ('%s','%s','0','0','%d','0','0','%d','con','1','%s');",steam_id,name,ping,users_fps,map)
SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
return PLUGIN_HANDLED
}
on client_disconnect
PHP Code:
public client_disconnect(id)
{
/* Maybe i should delete the table or check if there are resaults for player on client_connect bacause of server crashes or such problems */
g_iIsSpectator[id] = 0
new steam_id[33],Temp[512]
if (equal(steam_id,"ID_PENDING"))
{
return PLUGIN_HANDLED
}
format(Temp,charsmax(Temp),"DELETE FROM `catch_live` WHERE `authid` = '%s'", steam_id);
SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
return PLUGIN_HANDLED
}
the problem here is that the client is not anymore on server and i have no steamid to delete his stats.
__________________