Seguem as linhas do script :
Код:
stock SQL_ReturnEscaped(const string[])
{
static
entry[256];
mysql_real_escape_string(string, entry, g_iHandle);
return entry;
}
Код:
enum houseData {
houseID,
houseExists,
houseOwner,
housePrice,
houseAddress[32],
Float:housePos[4],
Float:houseInt[4],
houseInterior,
houseExterior,
houseExteriorVW,
houseLocked,
houseMoney,
houseMapIcon,
Text3D:houseText3D,
housePickup,
houseLights,
houseWeapons[10],
houseAmmo[10]
Код:
forward House_Load();
public House_Load()
{
static
rows,
fields,
str[128];
cache_get_data(rows, fields, g_iHandle);
for (new i = 0; i < rows; i ++) if (i < MAX_HOUSES)
{
HouseData[i][houseExists] = true;
HouseData[i][houseLights] = false;
HouseData[i][houseID] = cache_get_field_int(i, "houseID");
HouseData[i][houseOwner] = cache_get_field_int(i, "houseOwner");
HouseData[i][housePrice] = cache_get_field_int(i, "housePrice");
cache_get_field_content(i, "houseAddress", HouseData[i][houseAddress], g_iHandle);
HouseData[i][housePos][0] = cache_get_field_float(i, "housePosX");
HouseData[i][housePos][1] = cache_get_field_float(i, "housePosY");
HouseData[i][housePos][2] = cache_get_field_float(i, "housePosZ");
HouseData[i][housePos][3] = cache_get_field_float(i, "housePosA");
HouseData[i][houseInt][0] = cache_get_field_float(i, "houseIntX");
HouseData[i][houseInt][1] = cache_get_field_float(i, "houseIntY");
HouseData[i][houseInt][2] = cache_get_field_float(i, "houseIntZ");
HouseData[i][houseInt][3] = cache_get_field_float(i, "houseIntA");
HouseData[i][houseInterior] = cache_get_field_int(i, "houseInterior");
HouseData[i][houseExterior] = cache_get_field_int(i, "houseExterior");
HouseData[i][houseExteriorVW] = cache_get_field_int(i, "houseExteriorVW");
HouseData[i][houseLocked] = cache_get_field_int(i, "houseLocked");
HouseData[i][houseMoney] = cache_get_field_int(i, "houseMoney");
for (new j = 0; j < 10; j ++)
{
format(str, 24, "houseWeapon%d", j + 1);
HouseData[i][houseWeapons][j] = cache_get_field_int(i, str);
format(str, 24, "houseAmmo%d", j + 1);
HouseData[i][houseAmmo][j] = cache_get_field_int(i, str);
}
House_Refresh(i);
}
for (new i = 0; i < MAX_HOUSES; i ++) if (HouseData[i][houseExists]) {
format(str, sizeof(str), "SELECT * FROM `housestorage` WHERE `ID` = '%d'", HouseData[i][houseID]);
mysql_function_query(g_iHandle, str, true, "OnLoadStorage", "d", i);
format(str, sizeof(str), "SELECT * FROM `furniture` WHERE `ID` = '%d'", HouseData[i][houseID]);
mysql_function_query(g_iHandle, str, true, "OnLoadFurniture", "d", i);
}
return 1;
}
Код:
House_Save(houseid)
{
static
query[1536];
format(query, sizeof(query), "UPDATE `houses` SET `houseOwner` = '%d', `housePrice` = '%d', `houseAddress` = '%s', `housePosX` = '%.4f', `housePosY` = '%.4f', `housePosZ` = '%.4f', `housePosA` = '%.4f', `houseIntX` = '%.4f', `houseIntY` = '%.4f', `houseIntZ` = '%.4f', `houseIntA` = '%.4f', `houseInterior` = '%d', `houseExterior` = '%d', `houseExteriorVW` = '%d'",
HouseData[houseid][houseOwner],
HouseData[houseid][housePrice],
SQL_ReturnEscaped(HouseData[houseid][houseAddress]),
HouseData[houseid][housePos][0],
HouseData[houseid][housePos][1],
HouseData[houseid][housePos][2],
HouseData[houseid][housePos][3],
HouseData[houseid][houseInt][0],
HouseData[houseid][houseInt][1],
HouseData[houseid][houseInt][2],
HouseData[houseid][houseInt][3],
HouseData[houseid][houseInterior],
HouseData[houseid][houseExterior],
HouseData[houseid][houseExteriorVW]
);
for (new i = 0; i < 10; i ++) {
format(query, sizeof(query), "%s, `houseWeapon%d` = '%d', `houseAmmo%d` = '%d'", query, i + 1, HouseData[houseid][houseWeapons][i], i + 1, HouseData[houseid][houseAmmo][i]);
}
format(query, sizeof(query), "%s, `houseLocked` = '%d', `houseMoney` = '%d' WHERE `houseID` = '%d'",
query,
HouseData[houseid][houseLocked],
HouseData[houseid][houseMoney],
HouseData[houseid][houseID]
);
return mysql_function_query(g_iHandle, query, false, "", "");
}
Код:
House_Refresh(houseid)
{
if (houseid != -1 && HouseData[houseid][houseExists])
{
if (IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D]))
DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]);
if (IsValidDynamicPickup(HouseData[houseid][housePickup]))
DestroyDynamicPickup(HouseData[houseid][housePickup]);
static
string[128];
if (!HouseData[houseid][houseOwner]) {
format(string, sizeof(string), "Casa [%d]\nPreзo: %s\nEndereзo: %s", houseid, FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]);
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, 0x96821DFF, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 3.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
}
else {
format(string, sizeof(string), "Casa [%d]\nEndereзo: %s", houseid, HouseData[houseid][houseAddress]);
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_RAPHAEL, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 3.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
}
}
return 1;
}
Код:
House_Create(playerid, address[], price)
{
static
Float:x,
Float:y,
Float:z,
Float:angle;
if (GetPlayerPos(playerid, x, y, z) && GetPlayerFacingAngle(playerid, angle))
{
for (new i = 0; i != MAX_HOUSES; i ++)
{
if (!HouseData[i][houseExists])
{
HouseData[i][houseExists] = true;
HouseData[i][houseOwner] = 0;
HouseData[i][housePrice] = price;
HouseData[i][houseMoney] = 0;
format(HouseData[i][houseAddress], 32, address);
HouseData[i][housePos][0] = x;
HouseData[i][housePos][1] = y;
HouseData[i][housePos][2] = z;
HouseData[i][housePos][3] = angle;
HouseData[i][houseInt][0] = 318.6288;
HouseData[i][houseInt][1] = 1115.4702;
HouseData[i][houseInt][2] = 1084.4434;
HouseData[i][houseInt][3] = -91.0000;
HouseData[i][houseInterior] = 5;
HouseData[i][houseExterior] = GetPlayerInterior(playerid);
HouseData[i][houseExteriorVW] = GetPlayerVirtualWorld(playerid);
HouseData[i][houseLights] = false;
HouseData[i][houseLocked] = false;
House_Refresh(i);
mysql_function_query(g_iHandle, "INSERT INTO `houses` (`houseOwner`) VALUES(0)", false, "OnHouseCreated", "d", i);
return i;
}
}
}
return -1;
}
Print do erro :
http://imgur.com/a/ijVzt