Quote:
Originally Posted by Vince
Ew. Goto should never be used. It's bad practice, it leads to spaghetti code and it's a pain in the ass to debug. There's always a way to solve a problem without the need for goto. In this case it should just be a plain old for-loop.
|
Well, its hard to understand this loop to be honest. And im sure its hard to debug....So a for loop
Quote:
Originally Posted by 10MIN
Is a goto loop. Is normally not recommended.
Just change it to a foreach loop like:
PHP код:
foreach(new i: Players)
{
if(TrackPMs[i] == targetid)
{
format(str, sizeof(str), "((PM from %s to %s: %s))", GetOOCName(playerid), GetOOCName(targetid), message);
SendClientMessage(i, YELLOW, str);
PlayerPlaySound(i, 1085, 0, 0 ,0);
}
}
The code looks more simple and cleaner.
Hope I helped you ![Smiley](images/smilies/smile.png)
|
Yeah, thanks, make me understand this weird loop. Never use/heard about goto loop to be honest