save car problem +REP
#1

i want when i shutdown the server
then the server will get all cars pos and write it into cars.cfg
can some one learn me ?
Reply
#2

pawn Код:
stock SaveAllCars()
{
    new
        File:F,
        str[128],
        Float:P[4],
        Model;

    F = fopen("cars.cfg", io_write);
    for(new d = 1; d < MAX_VEHICLES; d++)
    {
        if((Model = GetVehicleModel(d)))
        {
            GetVehiclePos(d,P[0],P[1],P[2]);
            GetVehicleZAngle(d,P[3]);
            format(str,128,"%d,%.4f,%.4f,%.4f,%.4f\r\n",Model,P[0],P[1],P[2],P[3]);
            fwrite(F,str);
        }
    }
    fclose(F);
    return print("All Vehicles saved !");
}
In OnGameModeExit
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
stock SaveAllCars()
{
    new
        File:F,
        str[128],
        Float:P[4],
        Model;

    F = fopen("cars.cfg", io_write);
    for(new d = 1; d < MAX_VEHICLES; d++)
    {
        if((Model = GetVehicleModel(d)))
        {
            GetVehiclePos(d,P[0],P[1],P[2]);
            GetVehicleZAngle(d,P[3]);
            format(str,128,"%d,%.4f,%.4f,%.4f,%.4f\r\n",Model,P[0],P[1],P[2],P[3]);
            fwrite(F,str);
        }
    }
    fclose(F);
    return print("All Vehicles saved !");
}
In OnGameModeExit
very thanks ! it work ! the REP i your
but i have another question

if when the car have DestroyVehicle
it will be write in to the cars.cfg?
Reply
#4

No it will not write in cars.cfg you have to made It yourself
Reply
#5

Quote:
Originally Posted by Romel
Посмотреть сообщение
No it will not write in cars.cfg you have to made It yourself

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)