15.06.2010, 10:37
The reason for that is you want to use freezeonenterr to save players id, but you forget to save it. Therefor the ID unfreezed will always be 0 because a non-defined variable is 0.
This will also be bugged if 2 or more enters a house on the same time as then the first will not be unfreezed, so i would recommend you using SetTimerEx.
Try this instead
This will also be bugged if 2 or more enters a house on the same time as then the first will not be unfreezed, so i would recommend you using SetTimerEx.
pawn Код:
forward freezeonenter();
if(strcmp(cmd, "/enter", true) == 0)
{
for(new i = 0; i < sizeof(Houses); i++)
{
if(PlayerToPoint(1.0,playerid,Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Houses[i][EnterWorld])
{
if(PlayerInfo[playerid][pHouseKey] == i || Houses[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid, 0xAAAAAAAA, "You have been frozed, loading interior objects.");
TogglePlayerControllable(playerid, 0);
SetTimerEx("freezeonenter",3000,0,"playerid",playerid);
SetPlayerInterior(playerid,Houses[i][ExitInterior]);
SetPlayerPos(playerid,Houses[i][ExitX],Houses[i][ExitY],Houses[i][ExitZ]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerFacingAngle(playerid,Houses[i][ExitAngle]);
}
else
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
}
}
}
}
public freezeonenter(playerid)
{
TogglePlayerControllable(playerid, 1);
return 1;
}