Код:
#include <a_samp>
#include <Dini>
#define MAX_CARS 200
#define RED 0xF60000AA
#define File "cars/%s.uma"
enum carinfo
{
CarName,
CarModel,
CarCost,
CarOwner[24],
CarIsBought,
Float:SpawnX, // PickupX
Float:SpawnY, //PickupY
Float:SpawnZ, //PickupZ
Color1,
Color2,
Rotation,
Owned,
}
new CarInfo[MAX_CARS][carinfo];
new CarCount = -1; //Autode summa
new CarCreate[MAX_CARS];
stock LisaAuto(Filename[], CarMod, Cost, Float:Spawnx, Float:Spawny, Float:Spawnz, Rot, Col1, Col2)
{
new file[256];
format(file,sizeof(file),File,Filename);
new file2[256];
format(file2,sizeof(file2),"%s",Filename);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,"Owner",0);
dini_IntSet(file,"Owned",0);
}
CarCount ++;
new ID = CarCount;
CarInfo[ID][CarName] = strval(file2);
CarInfo[ID][CarIsBought] = 0;
CarInfo[ID][SpawnX] = Spawnx;
CarInfo[ID][SpawnY] = Spawny;
CarInfo[ID][SpawnZ] = Spawnz;
CarInfo[ID][CarModel] = CarMod;
CarInfo[ID][Color1] = Col1;
CarInfo[ID][Color2] = Col2;
CarInfo[ID][Rotation] = Rot;
CarInfo[ID][CarCost] = Cost;
CarCreate[ID] = AddStaticVehicle(CarMod,Spawnx,Spawny,Spawnz,Rot,Col1,Col2);
}
public OnFilterScriptInit()
{
LisaAuto("Infernus", 411, 5000, 2019.5199, -1253.3680, 23.7115, 116, 12, 12);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/vbuy", cmdtext) == 0)
{
for(new i; i<MAX_CARS; i++)
{
if(IsPlayerInAnyVehicle(playerid))
{
new file[256];
format(file,sizeof(file),"cars/%s.uma",CarInfo[i][CarName]);
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(vehicle != CarCreate[i]) return SendClientMessage(playerid,RED,"This car is not for sale!");
new Pname[24]; GetPlayerName(playerid, Pname, 24);
if(GetPlayerMoney(playerid) < CarInfo[i][CarCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this Car!");
if(CarInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This Car is already owned!");
dini_Set(file,"Owner",Pname);
dini_IntSet(file,"Owned",1);
GivePlayerMoney(playerid,- CarInfo[i][CarCost]);
GameTextForPlayer(playerid, "~r~Car Purchased!", 2000, 3);
CarInfo[i][Owned] = 1;
format(CarInfo[i][CarOwner], 24, "%s", Pname);
return 1;
}
else if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, RED, "You must be in a car!");
}
}
return 1;
}
if (strcmp("/vsell", cmdtext) == 0)
{
for(new i; i<MAX_CARS; i++)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Pname[24]; GetPlayerName(playerid, Pname, 24);
if(CarInfo[i][CarOwner] != strval(Pname)) return SendClientMessage(playerid,RED,"WARNING: You dont own this vehicle!");
//if(strcmp(Pname, CarInfo[i][CarOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this Car!");
GivePlayerMoney(playerid, CarInfo[i][CarCost]);
GameTextForPlayer(playerid, "~g~Car Sold!", 2000, 3);
CarInfo[i][Owned] = 0;
CarInfo[i][CarOwner] = EOS;
dini_Unset("Cars.ini", Pname);
return 1;
}
else if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, RED, "You are not in a vehicle!");
}
}
}
return 0;
}
I don't see a variable called "hFile" anywhere in that script you pasted, are you sure the error isn't originating from an include like Dini?