15.10.2013, 13:32
First of all, never use 2D arrays when working with numbers. Also don't put them inside quotes "". They aren't strings. Just advising...
Edit: Misiur w0s fuster xD
Usage:
Edit: Misiur w0s fuster xD
pawn Код:
stock IsPlayerInBike(playerid) //First way:
{
static const BikeModels[] = {448, 461, 462, 463, 468};
if(!IsPlayerInAnyVehicle(playerid)) return false;
new veh = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(BikeModels); i++)
{
if(GetVehicleModel(veh) == BikeModels[i]) return true;
}
return false;
}
stock IsPlayerInBike(playerid) //Second way:
{
if(!IsPlayerInAnyVehicle(playerid)) return false;
new veh = GetPlayerVehicleID(playerid);
switch(GetVehicleModel(veh))
{
case: 448, 461, 462, 463, 468: return true;
default: return false;
}
return false;
}
pawn Код:
if(IsPlayerInBike(playerid)) return SendClientMessage(playerid, -1, "You are in a bike");
if(!IsPlayerInBike(playerid)) return SendClientMessage(playerid, -1, "You are not in a bike");