File isn't creating...
#4

Dont use Dini for that
pawn Код:
CMD:createcar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 6)
    {
        new Float:px, Float:py, Float:pz, Float:angle;
        GetPlayerPos(playerid, px, py, pz);
        GetPlayerFacingAngle(playerid, angle);
        new vkol1;
        new vkol2;
        new vmodel;
        new vehicprice;
        new v;
        if(!sscanf(params, "iiii", vmodel, vkol1, vkol2, vehicprice))
        {
            new string[128];
            v = Index[topnumber] + 1;
            format(file4,sizeof(file4), "/vehicles/%d.ini", v);
            new File:Cars = fopen(file4,io_write);
            format(string,sizeof(string),"\
            model=%d\r\n \
            owner=1\r\n \
            forsale=1\r\n \
            vehx=%.4f\r\n \
            vehy=%.4f\r\n \
            vehz=%.4f\r\n \
            rot=%.4f\r\n \
            vcol1=%d\r\n \
            vcol2=%d\r\n \
            CarLock=0\r\n \
            Vehprice=%d\r\n"
,vmodel,px,py,pz,angle,vkol1,vkol2,vehicprice);
            fwrite(Cars,string);
            fclose(Cars);
            CarInfo[v][model] = vmodel;
            CarInfo[v][owner] = 1;
            CarInfo[v][forsale] = 1;
            CarInfo[v][vcol1] = vkol1;
            CarInfo[v][vcol2] = vkol2;
            CarInfo[v][CarLock] = 0;
            CarInfo[v][Vehprice] = vehicprice;
            ownablecar = CreateVehicle(CarInfo[v][model], px, py, pz, angle, CarInfo[v][vcol1], CarInfo[v][vcol2], 600000000000);
            vehiforsale[ownablecar] = CarInfo[v][forsale];
            vehiprice[ownablecar] = CarInfo[v][Vehprice];
            vehilocked[ownablecar] = 0;
            Index[topnumber] = Index[topnumber] + 1;
            format(string, sizeof(string), "Price: %d\nUse /buycar to buy this vehicle!",CarInfo[v][Vehprice]);
            VehicleLabel[v] = Create3DTextLabel(string ,COLOR_ORANGE, px, py, pz, 20, 0, 1);
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /createcar [Model ID] [Color 1] [Color 2] [Price]");
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command!");
}
Reply


Messages In This Thread
File isn't creating... - by milanosie - 02.02.2012, 16:57
Re: File isn't creating... - by Max_Coldheart - 02.02.2012, 17:01
Re: File isn't creating... - by milanosie - 02.02.2012, 17:03
Re: File isn't creating... - by Jefff - 02.02.2012, 18:45
Re: File isn't creating... - by milanosie - 02.02.2012, 18:51
Re: File isn't creating... - by milanosie - 02.02.2012, 19:00

Forum Jump:


Users browsing this thread: 2 Guest(s)