checking arrays
#1

i want to know if there is any way to check all same variables within arrays, dont know how to tell but there is code part:
Код:
if(pickupid==ArmourPickup[0]||ArmourPickup[1]||ArmourPickup[2]||ArmourPickup[3]||ArmourPickup[4]||ArmourPickup[5]||ArmourPickup[6]||ArmourPickup[7])
so is there any shorter to check if this is ANY ArmourPickup
Reply
#2

Try it with a loop:

pawn Код:
for( new x = 0; x < sizeof ArmourPickup; ++x ) {
  if( pickupid == ArmourPickup[ x ] ) {
    //Other codes...
  }
}
Reply
#3

thanks very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)