02.02.2012, 16:57
Hello there, I have a weird thing.
I have a code for /createcar, it should create a file.
It doesn't
The car spawns and stuff, but the file does not create.
what am I doing wrong?
I have a code for /createcar, it should create a file.
It doesn't
The car spawns and stuff, but the file does not create.
pawn Код:
CMD:createcar(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 6)
{
new Float:px, Float:py, Float:pz, Float:angle;
GetPlayerFacingAngle(playerid, angle);
GetPlayerPos(playerid, px, py, pz);
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);
dini_Create(file4);
dini_IntSet(file4, "model", CarInfo[v][model] = vmodel);
dini_IntSet(file4, "owner", CarInfo[v][owner] = 1);
dini_IntSet(file4, "forsale",CarInfo[v][forsale] = 1);
dini_FloatSet(file4, "vehx",px);
dini_FloatSet(file4, "vehy",py);
dini_FloatSet(file4, "vehz",pz);
dini_FloatSet(file4, "rot",angle);
dini_IntSet(file4, "vcol1",CarInfo[v][vcol1] = vkol1);
dini_IntSet(file4, "vcol2",CarInfo[v][vcol2] = vkol2);
dini_IntSet(file4, "CarLock",CarInfo[v][CarLock] = 0);
dini_IntSet(file4, "Vehprice",CarInfo[v][Vehprice] = vehicprice);
ownablecar = CreateVehicle(CarInfo[v][model], dini_Float(file4, "vehx"), dini_Float(file4, "vehy"), dini_Float(file4, "vehz"), dini_Float(file4, "rot"), 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, dini_Float(file4, "vehx"),dini_Float(file4, "vehy"),dini_Float(file4, "vehz"),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!");
}