Return problem ? I think
#6

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Why is still everyone talking about a loop? Thats bullshit.

PHP код:
public IsACopCar(carid)
{
    if(
carid 82){return 1;}//If the carid is between 0 and 81, its a cop car.
    
else return 0;

Because it's looping over array indices and comparing them. It's not comparing vehicleid's directly. Look closer. The above is also a horrible way to do it because it relies on assumptions. Should the list change then the code will break and the compiler won't tell you.
Reply


Messages In This Thread
Return problem ? I think - by Banditul18 - 02.04.2017, 19:15
Re: Return problem ? I think - by Toroi - 02.04.2017, 19:36
Re: Return problem ? I think - by Vince - 02.04.2017, 19:48
Re: Return problem ? I think - by GangstaSunny. - 02.04.2017, 19:54
Re: Return problem ? I think - by Banditul18 - 02.04.2017, 19:56
Re: Return problem ? I think - by Vince - 03.04.2017, 05:33
Re: Return problem ? I think - by GangstaSunny. - 03.04.2017, 08:08

Forum Jump:


Users browsing this thread: 1 Guest(s)