Just a simple question
#1

Hey .. I have a small question actually, not even a problem.

I have my var:
Код:
new admincar[15];
now under
OnPlayerEnterVehicle I set this:
Код:
if(vehicleid == admincar[0])
{
return 1;
}
I understand it has no effect but I will implement that later, now is there a way to put all the arrays in one if? instead of doing
Код:
if((vehicleid == admincar[0]) || vehicleid == admincar[1])
etc etc...
Reply
#2

pawn Код:
if(vehicleid >= admincar[0] && vehicleid <= admincar[14])
This will NOT work
Reply
#3

This is just a guess, because I have never done it before, and I hate arrays (xD) but can't you just use if(vehicleid == admincar)?

If not
Код:
for(new x=0; x<15; x++)
{
  if(vehicleid == admincar[x])
  {
    return 1;
  }
}
Reply
#4

Quote:
Originally Posted by Dark_Kostas
pawn Код:
if(vehicleid >= admincar[0] && vehicleid <= admincar[14])
This should work
That would only work if admincar[0-15] had consequtively incrementing values
Reply
#5

Quote:
Originally Posted by Redgie
This is just a guess, because I have never done it before, and I hate arrays (xD) but can't you just use if(vehicleid == admincar)?

If not
Код:
for(new x=0; x<14; x++)
{
  if(vehicleid == admincar[x])
  {
    return 1;
  }
}
Thank you Redgie.
Quote:
Originally Posted by Dark_Kostas
pawn Код:
if(vehicleid >= admincar[0] && vehicleid <= admincar[14])
Thanks for trying.
Reply
#6

Quote:
Originally Posted by Redgie
Quote:
Originally Posted by Dark_Kostas
pawn Код:
if(vehicleid >= admincar[0] && vehicleid <= admincar[14])
This should work
That would only work if admincar[0-15] had consequtively incrementing values
Yeah my fault, i didnt think about it xD
Reply
#7

Haha done that plenty of times, including now

OP: I originally put <14, but meant to put <15, I have updated my post. Good luck!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)