Question
#4

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 iPlayers)
{
     if(
TrackPMs[i] == targetid)
    {
                
format(strsizeof(str), "((PM from %s to %s: %s))"GetOOCName(playerid), GetOOCName(targetid), message);
                
SendClientMessage(iYELLOWstr);
                
PlayerPlaySound(i10850,0); 
    }

The code looks more simple and cleaner.
Hope I helped you
Yeah, thanks, make me understand this weird loop. Never use/heard about goto loop to be honest
Reply


Messages In This Thread
Goto loop question - by Banditul18 - 17.08.2017, 13:56
Re: Question - by Vince - 17.08.2017, 14:02
Re: Question - by 10MIN - 17.08.2017, 14:05
Re: Question - by Banditul18 - 17.08.2017, 14:26
Re: Question - by Arbico - 17.08.2017, 14:50

Forum Jump:


Users browsing this thread: 1 Guest(s)