I need help with making intregers
#3

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
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;
}
Usage:
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");
Reply


Messages In This Thread
I need help with making intregers - by iSkull - 15.10.2013, 13:05
Re: I need help with making intregers - by Misiur - 15.10.2013, 13:31
Re: I need help with making intregers - by Dragonsaurus - 15.10.2013, 13:32
Re: I need help with making intregers - by fordawinzz - 15.10.2013, 13:36
Re: I need help with making intregers - by iSkull - 15.10.2013, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)