03.09.2010, 12:11
Quote:
It looks cooler when you release the key if it disappears :P. Also for the loop, I really CBF making it efficient because I wrote it up in a short period of time. Feel free to fix it .
|
Here's how i would do it
pawn Код:
new InvalidNosVehicles[] =
{
430,446,448,449,452,453,454,461,462,463,468,472,473,481,484,
493,509,510,520,521,522,523,537,538,569,570,581,586,590,595
};
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & 4)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new
VehcileID,
VehicleModelID,
bool:Invalid;
VehicleID = GetPlayerVehicleID(playerid);
VehicleModelID = GetVehicleModel(VehicleID);
for(new a=0; a<sizeof(InvalidNosVehicles); a++)
{
if(VehicleModelID == InvalidNosVehicles[a])
{
Invalid = true;
break;
}
}
if(!Invalid) AddVehicleComponent(VehicleID, 1010);
}
}
return 1;
}
Im not at a place where i can compile / test :P, but should be fine. Someone could take it further and convert the array into a switch... but im to lazy :P.