First you have to remove the check for the team before setting the task. In other word:
PHP Code:
public client_spawn(id)
{
if(task_exists(id + USERTASK))
{
remove_task(id + USERTASK)
}
if(get_user_team(id) == 1)
{
userreason[id] = random_num(0, sizeof reasons - 1)
set_task(UPDATEDELAY, "client_jailinfo", id + USERTASK, _, _, "b")
}
}
Should look like this:
PHP Code:
public client_spawn(id)
{
if(task_exists(id + USERTASK))
{
remove_task(id + USERTASK)
}
userreason[id] = random_num(0, sizeof reasons - 1)
set_task(UPDATEDELAY, "client_jailinfo", id + USERTASK, _, _, "b")
}
Then we put a check and format the message depending on user's team in the task itself. There are two ways to do what you want, on my mind.
1)
PHP Code:
public client_jailinfo(TASKID)
{
static id
id = TASKID - USERTASK
set_hudmessage(0, 255, 0, 0.8, 0.1, 0, 6.0, 12.0)
new message[64]
switch(get_user_team(id))
{
case 1: formatex(message, charsmax(message), "Day: %d | Reason: %s", rounds, reasons[userreason[id]])
case 2: formatex(message, charsmax(message), "Day: %d", rounds)
}
ShowSyncHudMsg(id, hudhandler, message)
}
2)
PHP Code:
public client_jailinfo(TASKID)
{
static id
id = TASKID - USERTASK
set_hudmessage(0, 255, 0, 0.8, 0.1, 0, 6.0, 12.0)
new message[64]
formatex(message, charsmax(message)," | Reason: %s", reasons[userreason[id]])
ShowSyncHudMsg(id, hudhandler, "Day: %d%s", rounds, get_user_team(id) == 1 ? message : "")
}
__________________