25.04.2014, 19:58
Hello. Here is my stock:
Then the enter command:
It knows when I'm near the house or not, but when I am near the house and /enter it teleports me in the air.
pawn Код:
stock IsPlayerNearHouse(playerid)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1, HouseInfo[i][hEnterPos][0], HouseInfo[i][hEnterPos][1], HouseInfo[i][hEnterPos][2]))
{
return 1;
}
}
}
return 0;
}
pawn Код:
CMD:enter(playerid, params[])
{
if(IsPlayerNearHouse(playerid))
{
for(new i = 0; i < MAX_HOUSES; i++)
{
SetPlayerPos(playerid, HouseInfo[i][hExitPos][0], HouseInfo[i][hExitPos][1], HouseInfo[i][hExitPos][2]);
SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error"White": You are not near an entrance point.");
return 1;
}
return 1;
}