Car system freezes pawno
#2

Dini to Y_INI can be a complicated process for beginners, but if you know how Y_INI works, you'll be fine. Just look at the y_ini thread and it will explain enough for you to be able to study it, so I'll just give you the code for now :P

pawn Код:
stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[MAX_PLAYER_NAME], factioncar, noobcar)
{
    new carid = GetFreeVehicleSlot();
    validcar[carid] = true;
    new file[40];
    format(file, sizeof(file), "Vehicles/%d.ini", carid); //Change 'Vehicles/%d.ini' to the location of your vehicle file.
    new INI:carfile = INI_Open(file);
    INI_SetTag(carfile, "data");
    INI_WriteInt(carfile, "Model", modelid);
    INI_WriteFloat(carfile, "vX", x);
    INI_WriteFloat(carfile, "vY", y);
    INI_WriteFloat(carfile, "vZ", z);
    INI_WriteFloat(carfile, "vA", angle);
    INI_WriteInt(carfile, "Color1", color1);
    INI_WriteInt(carfile, "Color2", color2);
    INI_WriteInt(carfile, "Respawn", respawntime);
    INI_WriteString(carfile, "Owner", ownername);
    INI_WriteInt(carfile, "FactionCar", factioncar);
    INI_WriteInt(carfile, "NoobCar", noobcar);
    INI_Close(carfile);
    INI_ParseFile(file, "LoadVehicle_%s", .bExtra = true, .extra = carid);
    return CreateVehicle(modelid, x, y, z, angle, color1, color2, respawntime);
}

forward LoadVehicle_data(carid, name[], value[]);
public LoadVehicle_data(carid, name[], value[])
{
    INI_Int("Model", VehicleInfo[carid][vModel]);
    INI_Float("vX", VehicleInfo[carid][vX]);
    INI_Float("vY", VehicleInfo[carid][vY]);
    INI_Float("vZ", VehicleInfo[carid][vZ]);
    INI_Float("vA", VehicleInfo[carid][vA]);
    INI_Int("Color1", VehicleInfo[carid][vColor1]);
    INI_Int("Color2", VehicleInfo[carid][vColor2]);
    INI_Int("Respawn", VehicleInfo[carid][vRespawn]);
    INI_String("Owner", VehicleInfo[carid][vOwner], MAX_PLAYER_NAME);
    INI_Int("FactionCar", VehicleInfo[carid][vFaction]);
    INI_Int("NoobCar", VehicleInfo[carid][vNoob]);
}

stock LoadVehicle(carid)
{
    new file[40];
    format(file, sizeof(file), "Vehicles/%d.ini", carid); //Change 'Vehicles/%d.ini' to the location of your vehicle file.
    INI_ParseFile(file, "LoadVehicle_%s", .bExtra = true, .extra = carid);
    CreateVehicle(VehicleInfo[carid][vModel], VehicleInfo[carid][vX], VehicleInfo[carid][vY], VehicleInfo[carid][vZ], VehicleInfo[carid][vA], VehicleInfo[carid][vColor1], VehicleInfo[carid][vColor2], VehicleInfo[carid][vRespawn]);
    return 1;
}
This will load each car individually. You will need a loop under OnGameModeInit.
Reply


Messages In This Thread
Car system freezes pawno - by ThaCrypte - 26.02.2014, 22:55
Re: Car system freezes pawno - by Threshold - 26.02.2014, 23:18
Re: Car system freezes pawno - by ThaCrypte - 27.02.2014, 13:48
Re: Car system freezes pawno - by ThaCrypte - 27.02.2014, 21:32
Re: Car system freezes pawno - by Threshold - 27.02.2014, 22:22
Re: Car system freezes pawno - by ThaCrypte - 27.02.2014, 22:30

Forum Jump:


Users browsing this thread: 2 Guest(s)