what's the wrong!
#1

What the wrong with this stock:
pawn Код:
stock Loadpcars(playerid);
{
    if(PlayerInfo[playerid][pCarKey1] != 0)
    {
        new h = PlayerInfo[playerid][pCarKey1];
        CarSys[h] = AddStaticVehicleEx(CarInfo[h][tModel],CarInfo[h][tLocationx],CarInfo[h][tLocationy],CarInfo[h][tLocationz],CarInfo[h][tAngle],CarInfo[h][tColorOne],CarInfo[h][tColorTwo],60000);
        if(CarInfo[h][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h, CarInfo[h][tPaintjob]);
        }
        if(CarInfo[h][Neon] == 1)
        {
            ObjectSelect[h][0] = CreateObject(CarInfo[h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h][1] = CreateObject(CarInfo[h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate[10];
        strmid(plate, CarInfo[h][tLicensePlate], 0, strlen(CarInfo[h][tLicensePlate]), 255);
        SetVehicleNumberPlate(h, plate);
    }
    else if(PlayerInfo[playerid][pCarKey2] != 0)
    {
        new h2 = PlayerInfo[playerid][pCarKey2];
        CarSys[h2] = AddStaticVehicleEx(CarInfo[h2][tModel],CarInfo[h2][tLocationx],CarInfo[h2][tLocationy],CarInfo[h2][tLocationz],CarInfo[h2][tAngle],CarInfo[h2][tColorOne],CarInfo[h2][tColorTwo],60000);
        if(CarInfo[h2][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h2, CarInfo[h2][tPaintjob]);
        }
        if(CarInfo[h2][Neon] == 1)
        {
            ObjectSelect[h2][0] = CreateObject(CarInfo[h2][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h2][1] = CreateObject(CarInfo[h2][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h2][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h2][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate2[10];
        strmid2(plate2, CarInfo[h2][tLicensePlate], 0, strlen(CarInfo[h2][tLicensePlate]), 255);
        SetVehicleNumberPlate(h2, plate2);
    }
    else if(PlayerInfo[playerid][pCarKey3] != 0)
    {
        new h3 = PlayerInfo[playerid][pCarKey3];
        CarSys[h3] = AddStaticVehicleEx(CarInfo[h3][tModel],CarInfo[h3][tLocationx],CarInfo[h3][tLocationy],CarInfo[h3][tLocationz],CarInfo[h3][tAngle],CarInfo[h3][tColorOne],CarInfo[h3][tColorTwo],60000);
        if(CarInfo[h3][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h3, CarInfo[h3][tPaintjob]);
        }
        if(CarInfo[h3][Neon] == 1)
        {
            ObjectSelect[h3][0] = CreateObject(CarInfo[h3][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h3][1] = CreateObject(CarInfo[h3][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h3][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h3][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate3[10];
        strmid3(plate3, CarInfo[h3][tLicensePlate], 0, strlen(CarInfo[h3][tLicensePlate]), 255);
        SetVehicleNumberPlate(h3, plate3);
    }
    return 1;
}
I'm getting erros!
Reply
#2

What's this?

https://sampforum.blast.hk/showthread.php?tid=485209

@OnTopic

Use format instead of strmid, the code below should work.

pawn Код:
stock Loadpcars(playerid);
{
    if(PlayerInfo[playerid][pCarKey1] != 0)
    {
        new h = PlayerInfo[playerid][pCarKey1];
        CarSys[h] = AddStaticVehicleEx(CarInfo[h][tModel],CarInfo[h][tLocationx],CarInfo[h][tLocationy],CarInfo[h][tLocationz],CarInfo[h][tAngle],CarInfo[h][tColorOne],CarInfo[h][tColorTwo],60000);
        if(CarInfo[h][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h, CarInfo[h][tPaintjob]);
        }
        if(CarInfo[h][Neon] == 1)
        {
            ObjectSelect[h][0] = CreateObject(CarInfo[h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h][1] = CreateObject(CarInfo[h][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate[10];
        format(plate, sizeof(plate), "%s", CarInfo[h][tLicensePlate]);
        SetVehicleNumberPlate(h, plate);
    }
    else if(PlayerInfo[playerid][pCarKey2] != 0)
    {
        new h2 = PlayerInfo[playerid][pCarKey2];
        CarSys[h2] = AddStaticVehicleEx(CarInfo[h2][tModel],CarInfo[h2][tLocationx],CarInfo[h2][tLocationy],CarInfo[h2][tLocationz],CarInfo[h2][tAngle],CarInfo[h2][tColorOne],CarInfo[h2][tColorTwo],60000);
        if(CarInfo[h2][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h2, CarInfo[h2][tPaintjob]);
        }
        if(CarInfo[h2][Neon] == 1)
        {
            ObjectSelect[h2][0] = CreateObject(CarInfo[h2][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h2][1] = CreateObject(CarInfo[h2][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h2][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h2][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate2[10];
        format(plate2, sizeof(plate2), "%s", CarInfo[h][tLicensePlate]);
        SetVehicleNumberPlate(h2, plate2);
    }
    else if(PlayerInfo[playerid][pCarKey3] != 0)
    {
        new h3 = PlayerInfo[playerid][pCarKey3];
        CarSys[h3] = AddStaticVehicleEx(CarInfo[h3][tModel],CarInfo[h3][tLocationx],CarInfo[h3][tLocationy],CarInfo[h3][tLocationz],CarInfo[h3][tAngle],CarInfo[h3][tColorOne],CarInfo[h3][tColorTwo],60000);
        if(CarInfo[h3][tPaintjob] != 999)
        {
            ChangeVehiclePaintjob(h3, CarInfo[h3][tPaintjob]);
        }
        if(CarInfo[h3][Neon] == 1)
        {
            ObjectSelect[h3][0] = CreateObject(CarInfo[h3][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            ObjectSelect[h3][1] = CreateObject(CarInfo[h3][NeonObject],-0.8, 0.0, -0.55,0.00000000,0.00000000,0.00000000);
            AttachObjectToVehicle(ObjectSelect[h3][0], h, -0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(ObjectSelect[h3][1], h, 0.8, 0.0, -0.55, 0.0, 0.0, 0.0);
        }
        new plate3[10];
        format(plate3, sizeof(plate3), "%s", CarInfo[h][tLicensePlate]);
        SetVehicleNumberPlate(h3, plate3);
    }
    return 1;
}
- It might contain some error, because you did not show us the error log.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)