This plugin that I have written works well if I don't use tasks and just execute my command immediately (engclient_cmd), but doesn't work right with a set task delay. It looks like the data isn't being passed correctly.
Code:
PHP Code:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
register_plugin("Bot Say Sorry for TK", "1.0", "Fysiks")
RegisterHam(Ham_Killed, "player", "ham_player_killed",1)
}
public ham_player_killed( victim, killer, gib) // killer, victim, wpnindex, hitplace, TK)
{
// if(!is_user_bot(killer) || victim == killer || get_user_team(killer) != get_user_team(victim))
// return
// if(task_exists(killer)) remove_task(killer) // If bot kills two teammates less than 3 seconds apart
new idstring[3]
num_to_str(killer, idstring,2)
set_task(3.0, "say_sorry",killer,idstring,0)
server_print("Task Set %d,%s", killer,idstring)
return
}
public say_sorry(idstr[])
{
new idnum = str_to_num(idstr)
if(idnum) engclient_cmd(idnum,"say","Sorry!")
server_print("Should have been done (%d,%s)", idnum, idstr)
}
Some Results:
Code:
Task Set 8,8
Task Set 5,5
Should have been done (0,mFilter)
Should have been done (0,
And yes, there was nothing after that last comma

.