01.11.2011, 19:26
(
Последний раз редактировалось System64; 02.11.2011 в 09:03.
)
Hi all, I have a strange problem with my house system, so I have a house lock (like every house system) but problem is that I can lock every house if i'm in range of it, buyed or notbuyed houses...
EDIT: FIXED!
pawn Код:
YCMD:lockhouse(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(strcmp(HouseInfo[GetHouseID(playerid)][hOwner], GetName(playerid), false) == 0)
{
HouseInfo[GetHouseID(playerid)][hLocked] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "House is locked!");
format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 1 WHERE `HouseID` = %d", GetHouseID(playerid));
mysql_query(HQuery);
}
return 1;
}
YCMD:unlockhouse(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(strcmp(HouseInfo[GetHouseID(playerid)][hOwner], GetName(playerid), false) == 0)
{
HouseInfo[GetHouseID(playerid)][hLocked] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "House is unlocked!");
format(HQuery, sizeof(HQuery), "UPDATE `house` SET `Locked` = 0 WHERE `HouseID` = %d", GetHouseID(playerid));
mysql_query(HQuery);
}
return 1;
}
stock GetHouseID(playerid)
{
for(new i = 0; i < MAX_HOUSE; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ])) return i;
}
return -255;
}
EDIT: FIXED!