Vazovskui
Умник
Сделал свою сис-му домов:
Но ничего не происходит, почему?
PHP:
forward LoadHouse();
forward UpdateProperty();
enum hInfo
{
hOwned,
hOwner[128],
Float:hPosEnterX,
Float:hPosEnterY,
Float:hPosEnterZ,
Float:hPosExitX,
Float:hPosExitY,
Float:hPosExitZ,
Float:hPosSpawnX,
Float:hPosSpawnY,
Float:hPosSpawnZ,
Float:hPosSpawnA,
Float:hPosCarX,
Float:hPosCarY,
Float:hPosCarZ,
Float:hPosCarA,
hSafe,
hMoney,
hSkin1,
hSkin2,
hSkin3,
hWeapon1,
hWeapon2,
hWeapon3,
hLevel,
hValue,
hInt,
hLock,
hCar,
hCarColor1,
hCarColor2,
hHouseClass,
hRentValue,
hRent,
Text3D: hLabel,
hPickup,
hBar,
}
new HouseInfo[MAX_HOUSE][hInfo];
public UpdateProperty()
{
new File: file2;
new idx;
while (idx < sizeof(HouseInfo))
{
new coordsstring[1024];
format(coordsstring, sizeof(coordsstring), "%d,%s,%f,%f,%f,%d,%f,%f,%f,%d,%f,%f,%f,%f,%d,%f,%f,%f,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
HouseInfo[idx][hOwned],
HouseInfo[idx][hOwner],
HouseInfo[idx][hPosEnterX],
HouseInfo[idx][hPosEnterY],
HouseInfo[idx][hPosEnterZ],
HouseInfo[idx][hInt],
HouseInfo[idx][hPosExitX],
HouseInfo[idx][hPosExitY],
HouseInfo[idx][hPosExitZ],
HouseInfo[idx][hLevel],
HouseInfo[idx][hPosSpawnX],
HouseInfo[idx][hPosSpawnY],
HouseInfo[idx][hPosSpawnZ],
HouseInfo[idx][hPosSpawnA],
HouseInfo[idx][hHouseClass],
HouseInfo[idx][hPosCarX],
HouseInfo[idx][hPosCarY],
HouseInfo[idx][hPosCarZ],
HouseInfo[idx][hPosCarA],
HouseInfo[idx][hSafe],
HouseInfo[idx][hMoney],
HouseInfo[idx][hSkin1],
HouseInfo[idx][hSkin2],
HouseInfo[idx][hSkin3],
HouseInfo[idx][hWeapon1],
HouseInfo[idx][hWeapon2],
HouseInfo[idx][hWeapon3],
HouseInfo[idx][hValue],
HouseInfo[idx][hLock],
HouseInfo[idx][hCar],
HouseInfo[idx][hCarColor1],
HouseInfo[idx][hCarColor2],
HouseInfo[idx][hRentValue],
HouseInfo[idx][hRent],
HouseInfo[idx][hBar]);
if(idx == 0)
{
file2 = fopen("North/house.cfg", io_write);
}
else
{
file2 = fopen("North/house.cfg", io_append);
}
fwrite(file2, coordsstring);
fclose(file2);
}
return true;
}
public LoadHouse()
{
new arrCoords[35][64];
new strFromFile2[512];
new File: file = fopen("North/house.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
HouseInfo[idx][hOwned] = strval(arrCoords[0]);
strmid(HouseInfo[idx][hOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
HouseInfo[idx][hPosEnterX] = floatstr(arrCoords[2]);
HouseInfo[idx][hPosEnterY] = floatstr(arrCoords[3]);
HouseInfo[idx][hPosEnterZ] = floatstr(arrCoords[4]);
HouseInfo[idx][hInt] = strval(arrCoords[5]);
HouseInfo[idx][hPosExitX] = floatstr(arrCoords[6]);
HouseInfo[idx][hPosExitY] = floatstr(arrCoords[7]);
HouseInfo[idx][hPosExitZ] = floatstr(arrCoords[8]);
HouseInfo[idx][hLevel] = strval(arrCoords[9]);
HouseInfo[idx][hPosSpawnX] = floatstr(arrCoords[10]);
HouseInfo[idx][hPosSpawnY] = floatstr(arrCoords[11]);
HouseInfo[idx][hPosSpawnZ] = floatstr(arrCoords[12]);
HouseInfo[idx][hPosSpawnA] = floatstr(arrCoords[13]);
HouseInfo[idx][hHouseClass] = strval(arrCoords[14]);
HouseInfo[idx][hPosCarX] = floatstr(arrCoords[15]);
HouseInfo[idx][hPosCarY] = floatstr(arrCoords[16]);
HouseInfo[idx][hPosCarZ] = floatstr(arrCoords[17]);
HouseInfo[idx][hPosCarA] = floatstr(arrCoords[18]);
HouseInfo[idx][hSafe] = strval(arrCoords[19]);
HouseInfo[idx][hMoney] = strval(arrCoords[20]);
HouseInfo[idx][hSkin1] = strval(arrCoords[21]);
HouseInfo[idx][hSkin2] = strval(arrCoords[22]);
HouseInfo[idx][hSkin3] = strval(arrCoords[23]);
HouseInfo[idx][hWeapon1] = strval(arrCoords[24]);
HouseInfo[idx][hWeapon2] = strval(arrCoords[25]);
HouseInfo[idx][hWeapon3] = strval(arrCoords[26]);
HouseInfo[idx][hValue] = strval(arrCoords[27]);
HouseInfo[idx][hLock] = strval(arrCoords[28]);
HouseInfo[idx][hCar] = strval(arrCoords[29]);
HouseInfo[idx][hCarColor1] = strval(arrCoords[30]);
HouseInfo[idx][hCarColor2] = strval(arrCoords[31]);
HouseInfo[idx][hRentValue] = strval(arrCoords[32]);
HouseInfo[idx][hRent] = strval(arrCoords[33]);
HouseInfo[idx][hBar] = strval(arrCoords[34]);
printf("Дом: [%d] | Владелец: [%s] | Машина: [%d]",idx,HouseInfo[idx][hOwner],HouseInfo[idx][hCar]);
idx++;
}
fclose(file);
}
return true;
}
и вот например команда парковки домашней машины:
if(strcmp("/parkhc", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pHouseKey] != 255)
{
if(IsPlayerInVehicle(playerid,HouseInfo[PlayerInfo[playerid][pHouseKey]][hCar]))
{
new Float: X, Float: Y, Float: Z, Float: A;
GetVehiclePos(HouseInfo[playerid][hCar], X, Y, Z);
GetVehicleZAngle(HouseInfo[playerid][hCar], A);
HouseInfo[PlayerInfo[playerid][pHouseKey]][hPosCarX] = X;
HouseInfo[PlayerInfo[playerid][pHouseKey]][hPosCarY] = Y;
HouseInfo[PlayerInfo[playerid][pHouseKey]][hPosCarZ] = Z;
HouseInfo[PlayerInfo[playerid][pHouseKey]][hPosCarA] = A;
UpdateProperty();
}
}
}
