As already explained to you the $chan value doesnt survive into the timer, so u must pass it to the timer, now while in your case it likely is ok to pass it as $1 it can infact cause problems as expressed to me not long ago. because a channel like #$me well convert to your nick, thus u been pming yourself. (pretty od i know but still there)
also you should NEVER name a timer a number Doubly so the number 1 since that timer is amost always going to already exist.
heres a fix for this
alias distroles {
var %chan = $iif($ctimer,$mid($v1,19),$chan)
if (%plyrs == 3) {
set %game 2
msg %chan |MAFIABOT|Mafia game starting, %plyrs playing, distributing roles.
}
else {
msg %chan |MAFIABOT|Mafia game cancelled, not enough players signed up.
set %game 0
}
}
on *:TEXT:!mmafia start:#:{
if (%game == 0) {
msg $chan 0,1|MAFIABOT|Starting a game of mafia, type !mmafia in to join.
set %game 1
timer.!mmafia.start.on. $+ $chan 1 15 distroles
}
else if (%game > 0) /msg $chan 0,1|MAFIABOT|Game of mafia already in progress
}
I insert the name of the channel into the timer name at character 19, so when the alias is called it has the $ctimer value and you pull the channel name out of it, if the $ctimer doesnt exist u likely ran the alias your self, so it uses $chan, from there the alias uses the now set %chan value.