Quote:
Originally Posted by CrazY.
I like more with return values, but that's doesn't matter if you do not do wrong.
Code:
public FMVoiceSetClientListening(Recv,Sender,bool:Listen)
{
if (Recv == Sender)
return FMRES_IGNORED;
if (!is_user_connected(Recv) || !is_user_connected(Sender))
return FMRES_IGNORED;
if (get_user_team(Recv) != get_user_team(Sender))
return FMRES_IGNORED;
engfunc(EngFunc_SetClientListening,Recv,Sender,true);
return FMRES_SUPERCEDE;
}
|
I believe this is considered the best practice - check your cases early and return, makes it easy to follow the "main" path of the code and keeps the indentation low.
__________________