loop + rep
#1

hey,well,i got a code,for cars,it checks if the vehicle id is owned by the player id you write,but here is the code of it:
pawn Код:
new id = PlayerInfo[playerid][pCar][0], id2 = PlayerInfo[playerid][pCar][1], id3 = PlayerInfo[playerid][pCar][2];
            if(veh != CarInfo[id][c_ID] && veh != CarInfo[id2][c_ID] && veh != CarInfo[id3][c_ID]){
            if(CarInfo[PlayerInfo[playerid][pKeys]][c_ID] != veh){
                return 1;
            }
        }
it checks if player's car 1 or 2 or 3 is the vehicle id,but i have changed it to 20,how can i loop them so if any car of his cars,from 0 to 20 is that vehicle id,it notices?
Reply
#2

pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
            new id = PlayerInfo[i][pCar][0], id2 = PlayerInfo[i][pCar][1], id3 = PlayerInfo[i][pCar][2];
            if(veh != CarInfo[id][c_ID] && veh != CarInfo[id2][c_ID] && veh != CarInfo[id3][c_ID]){
            if(CarInfo[PlayerInfo[i][pKeys]][c_ID] != veh) return 1;
}
Reply
#3

read the post again
Reply
#4

If you have changed the selection from 0 - 3 to 0 - 20 - You need to add the new ID's that it checks, for example.

veh != CarInfo[id][c_ID]
veh != CarInfo[id1][c_ID]
veh != CarInfo[id2][c_ID]
veh != CarInfo[id3][c_ID]
veh != CarInfo[id4][c_ID]
veh != CarInfo[id5][c_ID]
veh != CarInfo[id6][c_ID]
veh != CarInfo[id7][c_ID]
veh != CarInfo[id8][c_ID]
Reply
#5

is there any way to loop them all together,so it do be 1 line instead of 20?
Reply
#6

You can, however I don't want to code something that you wont understand - If you try make one and post it below then ill fix it for ya
Reply
#7

lol no,i am not that noob to do not understand the code,just try to code it for me...
Reply
#8

Well First You Will Have To Define The IDS anyway so good luck adding them

Then just change the second line to this

Quote:

if(veh < != CarInfo[id][c_ID] || veh > != CarInfo[id20][c_ID])

Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)