08.01.2015, 20:39
I keep getting unknown command if im not in range of a house I own. but if I am in range the command does what its suppose to
Here is the command:
Here is the command:
Код:
CMD:lockhouse(playerid, params[])
{
new hid = 0;
hid = IsPlayerNearHouse(playerid);
printf("house id: %i", hid);
if(hid == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not in range of a house you own.");
if(hInfo[hid][hLocked] == 1)
{
hInfo[hid][hLocked] = 0;
GameTextForPlayer(playerid, "~g~Unlocked", 1000, 6);
}
else if(hInfo[hid][hLocked] == 0)
{
hInfo[hid][hLocked] = 1;
GameTextForPlayer(playerid, "~r~Locked", 1000, 6);
}
return 1;
}
stock IsPlayerNearHouse(playerid)
{
for(new i = 0; i <= sizeof(hInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, hInfo[i][hPos][0], hInfo[i][hPos][1], hInfo[i][hPos][2]))
{
if(strcmp(GetNameEx(playerid), hInfo[i][hOwner], true) == 0)
{
printf("%i", i);
return i;
}
}
}
return 0;
}


