SA-MP Forums Archive
Small problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small problem (/showthread.php?tid=402268)



Small problem - MattSlater - 25.12.2012

pawn Код:
CMD:vstorage(playerid, params[])
{
    new szCars[1024];
    for(new v; v < MAX_PLAYER_VEHICLES; v++) {
        if(playerVehicles[playerid][v][cModelID] > 399) {
            if(playerVehicles[playerid][v][cStored] == 0) {
                format(szCars, sizeof(szCars), "[%d] | %s | Stored(click to spawn) ", v, VehicleName[playerVehicles[playerid][v][cModelID] - 400]);
            }
            else if(playerVehicles[playerid][v][cStored] == 1) {
                format(szCars, sizeof(szCars), "[%d] | %s | Spawned(click to store)", v, VehicleName[playerVehicles[playerid][v][cModelID] - 400]);
            }
        }
        else strcat(szCars, "\nEmpty(available slot)");
    }
    ShowPlayerDialog(playerid, DIALOG_MYCARS, DIALOG_STYLE_LIST, "[ VEHICLES ]", szCars, "Select", "Cancel");
    return 1;
}
Okay, so im creating a player vehicle system, and the max player cars are 8(defined), and when I do /vstorage it displays the last car.. (, I have no idea why, it only displays ONE car which is the last

I presume this is a small fix, thanks


Re: Small problem - Jefff - 25.12.2012

pawn Код:
CMD:vstorage(playerid, params[])
{
    new szCars[1024],Model;
    for(new v; v < MAX_PLAYER_VEHICLES; v++)
        if((Model = playerVehicles[playerid][v][cModelID]) > 399)
        {
            if(playerVehicles[playerid][v][cStored] == 0)
                format(szCars, sizeof(szCars), "%s[%d] | %s | Stored(click to spawn)\n",szCars, v, VehicleName[Model - 400]);
            else
                format(szCars, sizeof(szCars), "%s[%d] | %s | Spawned(click to store)\n",szCars, v, VehicleName[Model - 400]);
        }else strcat(szCars, "Empty(available slot)\n");
       
    szCars[strlen(szCars)-1] = 0;

    return ShowPlayerDialog(playerid, DIALOG_MYCARS, DIALOG_STYLE_LIST, "[ VEHICLES ]", szCars, "Select", "Cancel");
}



Re: Small problem - MattSlater - 25.12.2012

Didn't change anything ;/

EDIT: Fixed, thank you, just realised the other n's on the szCars, thanks man!

EDIT: Maybe not, should of tested it before saying it's fixed...

EDIT: I fixed it lol yolo