Run time error 4: "Array index out of bounds"
#5

pawn Code:
COMMAND:takecar(playerid, params[])
{
    new bool:IsAtGarage, takecarr[128];
    GarageLoop(g)
    {
        if(PublicGarage[g][gActive] == 0) continue;
        if(IsPlayerInRangeOfPoint(playerid, 2.0, PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ]))
        {
            new zone[50];
            IsAtGarage = true;
            GetZone(PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ], zone);
            format(takecarr, sizeof(takecarr), "{D3D3D3}Take a vehicle from {778899}%s {D3D3D3}Garage", zone);
            break;
        }
    }
    if(!IsAtGarage) return SendClientError(playerid, "You need to be outside a public garage to use this command");

    IsAtGarage = false;

    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    new Lrg[1800], count, statusaa[20];
    VehLoop(v)
    {
        if(Vehicle[v][vActive] == 0) continue;

        if(Vehicle[v][owner][0] != 0 && !strcmp(Vehicle[v][owner], pname))
        {
            IsAtGarage = true;
            if(Vehicle[v][InGarage] == 1) statusaa = "{B0C4DE}Stored";
            else statusaa = "{ff0000}Spawned";
            format(LrgStr, sizeof(LrgStr), "{778899}Vehicle: {B0C4DE}%s {ffffff}>> {778899}Status: %s\n", GetVehicleNameFromModel(Vehicle[v][model]), statusaa);
            strcat(Lrg, LrgStr);
        }
    }
    if(!count) return SendClientError(playerid, "You currently do not own any vehicles");
    return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, takecarr, Lrg, "Take", "Cancel");
}
and you don't need format here

pawn Code:
stock GetVehicleNameFromModel(modelid)
    return VehicleName[modelid-400];
Reply


Messages In This Thread
Run time error 4: "Array index out of bounds" - by d3ll - 20.05.2014, 22:26
Re: Run time error 4: "Array index out of bounds" - by arakuta - 20.05.2014, 23:59
Re: Run time error 4: "Array index out of bounds" - by Jefff - 21.05.2014, 00:31
Re: Run time error 4: "Array index out of bounds" - by d3ll - 21.05.2014, 00:34
Re: Run time error 4: "Array index out of bounds" - by Jefff - 21.05.2014, 00:48

Forum Jump:


Users browsing this thread: 3 Guest(s)