How to write more of those on a row
#1

Код:
if(vehicleid == meatcar_1 ... meatcar_2 .... meatcar_3
I want them on a row instead of:
Код:
if(vehicleid == meatcar_1)
{
 bla bla
}
if(vehicleid == meatcar_2)

....
Reply
#2

PHP код:
if(vehicleid == meatcar_1||vehicleid == meatcar_2
Reply
#3

It works thanks but why I can only enther the third vehicle?
meatcar_1 = CreateVehicle(413,-88.068,1339.272,10.766,187.255,65,0,-1);
meatcar_2 = CreateVehicle(413,-85.147,1339.661,10.875,187.084,65,0,-1);
meatcar_3 = CreateVehicle(413,-106.629,1362.633,10.278,184.002,65,0,-1);
meatcar_4 = CreateVehicle(413,-78.739,1340.336,11.131,186.607,65,0,-1);
meatcar_5 = CreateVehicle(413,-81.778,1339.995,10.993,186.600,65,0,-1);
Reply
#4

Use arrays if you have more than two or three items. This allows for easy loops and easy expansion later on; i.e;:

PHP код:
// global
new gMeatcar[5];

// GameModeInit
gMeatcar[0] = CreateVehicle(...);
// etc

// Wherever
for(new isizeof(gMeatcar); i++)
{
    if(
vehicleid == gMeatcar[i])
    {
        
// do stuff
        
break;
    }

Reply
#5

Oh damn, forgot of that, thank you both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)