LoadVehicles || Own scratch made vehicles Ownership help.
#1

Hello. I am creating my own vehicles ownership from scratch. Milanosie is helping me much, but i am too noob to understand and he also has his own scripts to do as owner of the great server i play.

So i am asking you some help. :P
I created the /createvehicle command, and it saves the car, create it, a text label all right.
It creates 1 file for each car.

But i don't know how to make all cars load from the file on server restart.....
The /createvehicle cmd:
pawn Код:
CMD:createvehicle(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 5)
    {
        new Float:px, Float:py, Float:pz, Float:angle, vkol1, vkol2, vmodel, vprice, v, string[128];
        GetPlayerFacingAngle(playerid, angle);
        GetPlayerPos(playerid, px, py, pz);
        if(!sscanf(params, "iiii", vmodel, vkol1, vkol2, vprice))
        {
            v = VehicleInfo[topnumber]+1;
            format(file, sizeof(file), "RRP/vehicles/%d.ini", v);
            dini_Create(file);
            dini_FloatSet(file, "X", Float:px);
            dini_FloatSet(file, "Y", Float:py);
            dini_FloatSet(file, "Z", Float:pz);
            dini_FloatSet(file, "A", Float:angle);
            dini_IntSet(file, "Model", vmodel);
            dini_IntSet(file, "Color1", vkol1);
            dini_IntSet(file, "Color2", vkol2);
            dini_IntSet(file, "Price", vprice);
            CreateVehicle(vmodel, Float:px, Float:py, Float:pz, Float:angle, vkol1, vkol2, 86400);
            format(string, sizeof(string), "This vehicle is for sale. Price: %d", vprice);
            Create3DTextLabel(string, COLOR_RED, Float:px, Float:py, Float:pz, 10.0, 0, 0);
            VehicleInfo[topnumber] = VehicleInfo[topnumber]+1;
            format(file, sizeof(file), "RRP/vehicles/Vindex.ini");
            if(fexist(file))
            {
                dini_IntSet(file, "topnumber", VehicleInfo[topnumber]);
            }
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_DARKGOLD, "USAGE: /createcar [Model ID] [Color 1] [Color 2] [Price]");
    }
    else return NotAdmin(playerid);
}
THANK YOU.
Reply


Messages In This Thread
LoadVehicles || Own scratch made vehicles Ownership help. - by ricardo178 - 15.02.2012, 21:43
Re: LoadVehicles || Own scratch made vehicles Ownership help. - by PrawkC - 16.02.2012, 00:04
Re : LoadVehicles || Own scratch made vehicles Ownership help. - by ricardo178 - 16.02.2012, 00:40

Forum Jump:


Users browsing this thread: 2 Guest(s)