How do i make this cmd to save into a .cfg file ?
#7

You can use these functions.

pawn Код:
LoadPlates()
{
    new line[256];
    new Text3D:VText;
    new File: file = fopen("carplates.cfg", io_read);
    if (file)
    {
        new idx = 1;
        while (fread(file, line))
        {
            format(CarPlate[idx], sizeof(CarPlate[]), line);
            VText = Create3DTextLabel(CarPlate[idx],0x008080FF,0.0,0.0,0.0,20,0,1);
            Attach3DTextLabelToVehicle(VText, idx, 0.0, 0.0, 0.0);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
pawn Код:
SavePlates()
{
    new File: file = fopen("carplates.cfg", io_write);
    new idx = 1;
    while (idx < sizeof(CarPlate))
    {
        fwrite(file, CarPlate[idx]);
        fwrite(file, "\r\n");
        idx++;
    }
    fclose(file);
    return 1;
}
Also put this top of script:

pawn Код:
new CarPlate[MAX_VEHICLES][24];
And then in your /regplate command

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
                {
                    new vehicleid = GetPlayerVehicleID(playerid);
                    new Text3D:VText;
                    format(CarPlate[vehicleid], sizeof(CarPlate[]), result);
                    VText = Create3DTextLabel(CarPlate[vehicleid],0x008080FF,0.0,0.0,0.0,20,0,1);
                    Attach3DTextLabelToVehicle(VText, vehicleid, 0.0, 0.0, 0.0);
                    SavePlates();
                }
Also put LoadPlates(); in OnGameModeInit.
Reply


Messages In This Thread
How do i make this cmd to save into a .cfg file ? - by Chivava - 05.02.2010, 21:40
Re: How do i make this cmd to save into a .cfg file ? - by Chivava - 06.02.2010, 07:49
Re: How do i make this cmd to save into a .cfg file ? - by Perker12345 - 06.02.2010, 08:16
Re: How do i make this cmd to save into a .cfg file ? - by Chivava - 06.02.2010, 08:41
Re: How do i make this cmd to save into a .cfg file ? - by Perker12345 - 06.02.2010, 08:44
Re: How do i make this cmd to save into a .cfg file ? - by Chivava - 06.02.2010, 08:48
Re: How do i make this cmd to save into a .cfg file ? - by MadeMan - 06.02.2010, 09:24
Re: How do i make this cmd to save into a .cfg file ? - by Perker12345 - 06.02.2010, 10:23
Re: How do i make this cmd to save into a .cfg file ? - by MadeMan - 06.02.2010, 10:26
Re: How do i make this cmd to save into a .cfg file ? - by Perker12345 - 06.02.2010, 10:30
Re: How do i make this cmd to save into a .cfg file ? - by MadeMan - 06.02.2010, 10:33
Re: How do i make this cmd to save into a .cfg file ? - by Perker12345 - 06.02.2010, 10:41
Re: How do i make this cmd to save into a .cfg file ? - by MadeMan - 06.02.2010, 10:48
Re: How do i make this cmd to save into a .cfg file ? - by Chivava - 06.02.2010, 11:01
Re: How do i make this cmd to save into a .cfg file ? - by MadeMan - 06.02.2010, 11:02
Re: How do i make this cmd to save into a .cfg file ? - by Chivava - 07.02.2010, 13:22
Re: How do i make this cmd to save into a .cfg file ? - by adytzu32 - 11.03.2010, 14:45
Re: How do i make this cmd to save into a .cfg file ? - by adytzu32 - 11.03.2010, 18:01
Re: How do i make this cmd to save into a .cfg file ? - by yvaxxx - 27.03.2010, 09:01

Forum Jump:


Users browsing this thread: 2 Guest(s)