You're just checking for bikes, and bikes are not the only unsupported vehicles. Here's my command plus a function from somebody I don't really remember.
Yeah. It's a full solution.
Command:
Код:
if(strcmp(cmdtext,"/nos",true)==0)
{
if(IsPlayerInInvalidNosVehicle(playerid)) {
SendClientMessage(playerid,0xFFFF00FF,"You can't add nitro to this car.");
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
if(GetPlayerState(playerid) == 2) {
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
SendClientMessage(playerid,0x00FF00FF,"Your car now has nitro.");
return 1;
}
else {
SendClientMessage(playerid,0xFFFF00FF"You must be the driver of the vehicle in order to add nitro.");
return 1;
}
}
else {
SendClientMessage(playerid,0xFFFF00FF,"Seriously... you have to be in a vehicle to add nitro.");
return 1;
}
}
Now add this to the end of your nice script:
Код:
stock IsPlayerInInvalidNosVehicle(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
{
if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
{
return true;
}
}
}
return false;
}
And finally, add this to the top with your defines and shit:
Код:
native IsPlayerInInvalidNosVehicle(playerid);
new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
{
581,523,462,521,463,522,461,448,468,586,417,425,469,487,512,520,563,593,
509,481,510,472,473,493,520,595,484,430,453,432,476,497,513,533,577,
452,446,447,454,590,569,537,538,570,449,519,460,488,511,519,548,592
};
I use an include, so report any problem with the codes and I'll fix it for you.