Hello, i am experiencing an issue with set_task that its something is calling its function regardless, i couldn't tell how its being called but i did gathered some info.
Its Calling the task twice or more depending on when the last players were killed, also i have clcorpse usermsg hooked and i am disabling the hook on the end of the event, when i tried removing the hook totally everything was fine ?!?!
Code:
EndTheRound called TASKID: 2 TASK_EXIST? NO
aWinner Len: 15 => "ommon/null.wav"
EndTheRound called TASKID: 35000 TASK_EXIST? YES
aWinner Len: 1 => "3"
PHP Code:
#define TASK_END_ROUND 35000
public function()
{
static const Float:ROUND_TIME_LEFT = 5.0;
new aWinner[1]; aWinner[0] = '3';
set_task(ROUND_TIME_LEFT, "EndTheRound", TASK_END_ROUND, aWinner, sizeof aWinner);
}
public EndTheRound(const aWinner[], const taskid)
{
if(bHAS_ROUND_ENDED) return;
cprint_chat(0, _, "EndTheRound called TASKID: %d TASK_EXIST? %s", taskid, task_exists(taskid, 1) ? "YES":"NO");
cprint_chat(0, _, "aWinner Len: %d => ^"%s^"", strlen(aWinner), aWinner);
switch( aWinner[0] )
{
case '1': TerminateRound( TR_RoundEndType_TeamExterminate, TeamWinning_Terrorist );
case '2': TerminateRound( TR_RoundEndType_TeamExterminate, TeamWinning_Ct );
case '3': TerminateRound( TR_RoundEndType_Draw );
}
}
__________________