the "for" block all what happend after ... :\
#1

I did this -

PHP код:
new GangCar[21]; 
PHP код:
GangCar[0] = AddStaticVehicle(411,-2592.2876,665.7452,27.4933,269.2205,0,0); //
GangCar[1] = AddStaticVehicle(411,-2591.9468,655.2901,27.5090,270.2450,0,0); //
.
.
.

PHP код:
forward CreateCar(car);
public 
CreateCar(car)
{
.
.
.
.
    for(new 
Car;Car<=sizeof(GangCar);Car++)
    {
        if(
GangCar[Car] == car)
        {
        
dini_IntSet(fileCar,"Gangable",1);
        
dini_IntSet(fileCar,"CarSpecial",0);
        
dini_IntSet(fileCar,"Buyable",0);
        break;
        }
    }
.
.
all what i do here not happend because it's blocked.
.
.
    return 1;

and it's block all what happend after.. i try this -


PHP код:
    if(
    
GangCar[0] == car ||
    
GangCar[1] == car ||
    
GangCar[2] == car ||
    
GangCar[3] == car ||
    
GangCar[4] == car ||
    
GangCar[5] == car ||
    
GangCar[6] == car ||
    
GangCar[7] == car ||
    
GangCar[8] == car ||
    
GangCar[9] == car ||
    
GangCar[10] == car ||
    
GangCar[11] == car ||
    
GangCar[12] == car ||
    
GangCar[13] == car ||
    
GangCar[14] == car ||
    
GangCar[15] == car ||
    
GangCar[16] == car ||
    
GangCar[17] == car ||
    
GangCar[18] == car ||
    
GangCar[19] == car ||
    
GangCar[20] == car
    
)
        
dini_IntSet(fileCar,"Gangable",1);
        
dini_IntSet(fileCar,"CarSpecial",0);
        
dini_IntSet(fileCar,"Buyable",0);
    } 
and it's work .. but i want to use for, what not good?

thanks
Reply
#2

Quote:
Originally Posted by SA-MP Wiki
Break breaks out of a loop, ending it prematurely:
Replace it with Car++;
Reply
#3

lmfao.. ^ learn pawn better before u try to 'help' other users

@ tal_peretz: idk looks fine should work, what's wrong with the for loop?
Reply
#4

Quote:
Originally Posted by CmZxC
Посмотреть сообщение
Replace it with Car++;
i don't use things that i don't know what they do .. this is not the problam man, break is stop the loop and skip, this is not skip.
Reply
#5

pawn Код:
for(new i=0;i<=20;i++)
    {
        if(GangCar[i] == car)
        {
        dini_IntSet(fileCar,"Gangable",1);
        dini_IntSet(fileCar,"CarSpecial",0);
        dini_IntSet(fileCar,"Buyable",0);
        break;
        }
    }
try this ? although i dont think will make a difference..
Reply
#6

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
lmfao.. ^ learn pawn better before u try to 'help' other users

@ tal_peretz: idk looks fine should work, what's wrong with the for loop?
I editted the post maybe you will see the problam...
Reply
#7

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
pawn Код:
for(new i=0;i<=20;i++)
    {
        if(GangCar[i] == car)
        {
        dini_IntSet(fileCar,"Gangable",1);
        dini_IntSet(fileCar,"CarSpecial",0);
        dini_IntSet(fileCar,"Buyable",0);
        break;
        }
    }
try this ? although i dont think will make a difference..
i try it not work
Reply
#8

jump
Reply
#9

I did again in OnPlayerConnect -

PHP код:
for(new ii<=sizeof(Nicks);i++)
if(!
strcmp(Nicks[i],Name,false)) ......... 
and it's block all the other public after that ... what not good ?!?!!??!?!
Reply
#10

It's not <=.

Try for (new Car; Car < sizeof(GangCar); Car++)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)