Quote:
Originally Posted by Donny
Quote:
Originally Posted by 0rb
Donny you don't need the new v because the switch statement is evaluated only once :P
|
I wasn't sure if it only performed the single instruction on the element or it did indeed have to recall on each case, I went safe but obviously I was wrong so thanks for the correction dude.
Revised code:
pawn Код:
IsPlayerInPlane( playerid ) { // no need for the first check now as the case will be 0 so it will return false, single instruction ftw :) switch ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) ) { case 548, 469, 447, 563, 497, 488, 487, 417, 425 : return true; } return false; }
|
or
pawn Код:
IsPlayerInPlane( playerid )
{
switch ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) )
case 548, 469, 447, 563, 497, 488, 487, 417, 425 : return true;
return false;
}
Less lines :> (owned)
I really dislike to do things with useless lines.