25.04.2012, 18:42
Hello,
I made this command for buy car, but when i type it, its Creating files, not 1 file but multiple ones and keep doing it.
Any idea how to fix it?
Here is the command:
Ignore the arrays since in my .pwn its ALL correct!
Thanks for your support!
I made this command for buy car, but when i type it, its Creating files, not 1 file but multiple ones and keep doing it.
Any idea how to fix it?
Here is the command:
Код:
if(strcmp(cmd, "/buycar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new model = GetVehicleModel(idcar);
if(IsASalesVehicle(idcar))
{
if(PlayerInfo[playerid][pPcarkey] != 9999 && PlayerInfo[playerid][pPcarkey2] != 9999)
{
SendClientMessage(playerid, COLOR_CREAM, " You aleady own 2 vehicles.");
return 1;
}
else
{
if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
for(new h = 1; h < sizeof(CarInfo); h++)
{
format(string, sizeof(string),"Vehicles/%d.ini",h)
dini_Create(string);
if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = h; }
else { PlayerInfo[playerid][pPcarkey] = h; }
CarInfo[h][cOwned] = 1;
strmid(CarInfo[h][cOwner], sendername, 0, strlen(sendername), 255);
CarInfo[h][cModel] = model;
CarInfo[h][cVirWorld] = 0;
CarInfo[h][cPaintjob] = 999;
CarInfo[h][cColorOne] = 1;
CarInfo[h][cColorTwo] = 1;
CarInfo[h][cComponent0] = 0;
CarInfo[h][cComponent1] = 0;
CarInfo[h][cComponent2] = 0;
CarInfo[h][cComponent3] = 0;
CarInfo[h][cComponent4] = 0;
CarInfo[h][cComponent5] = 0;
CarInfo[h][cComponent6] = 0;
CarInfo[h][cComponent7] = 0;
CarInfo[h][cComponent8] = 0;
CarInfo[h][cComponent9] = 0;
CarInfo[h][cComponent10] = 0;
CarInfo[h][cComponent11] = 0;
CarInfo[h][cComponent12] = 0;
CarInfo[h][cComponent13] = 0;
SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
{
CarInfo[h][cLocationx] = 1432.6451;
CarInfo[h][cLocationy] = 1378.7216;
CarInfo[h][cLocationz] = 11.5507;
CarInfo[h][cAngle] = 359.2072;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3);
}
else if(IsModelABoat(idcar))
{
CarInfo[h][cLocationx] = -1568.9614;
CarInfo[h][cLocationy] = 169.0118;
CarInfo[h][cLocationz] = -0.6016;
CarInfo[h][cAngle] = 208.7506;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
}
else
{
CarInfo[h][cLocationx] = -1589.2644;
CarInfo[h][cLocationy] = 106.9119;
CarInfo[h][cLocationz] = 3.5495;
CarInfo[h][cAngle] = 317.1649;
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
}
ownedcar[h] = CreateVehicle(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz],90.0,1,1,30000);
gEngine[playerid] = 0;
engineOn[GetPlayerVehicleID(playerid)] = false;
OnPropUpdate(4,h);
OnPlayerUpdateEx(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
}
return 1;
}
Thanks for your support!

