Код:
IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
return 1;
}
return 0;
}
Place that ** anywhere in your script
and replace this with ur old one.
Код:
for(new i = 0; i < MAX_LANDS; i++)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(isPlayerInArea(playerid,LandInfo[i][landZone]))//69403
{
for(new x = 0; x < 251; x ++)
{
new Float:Pos[3];
new Float:Rot[3];
if(IsValidDynamicObject(LandInfo[i][landObjects][x]))
{
GetDynamicObjectPos(LandInfo[i][landObjects][x], Pos[0], Pos[1], Pos[2]);
GetDynamicObjectRot(LandInfo[i][landObjects][x], Rot[0], Rot[1], Rot[2]);
if(IsPlayerInRangeOfPoint(playerid, Pos[0], Pos[1], Pos[2], 6.0))
{
if(objectInfo[x][oDoor] == 1)
{
if(strcmp(playername, LandInfo[i][landOwner], true) == 0 || PlayerInfo[playerid][pLandPerms] >= 1 && PlayerInfo[playerid][pEditLand] == i || TempLandPerm[playerid] == i)
{
if(objectInfo[x][oDoorOpen] == 0)
{
SetDynamicObjectRot(LandInfo[i][landObjects][x], Rot[0], 90.0, Rot[2]);
objectInfo[x][oDoorOpen] = 0;
}
else
{
SetDynamicObjectRot(LandInfo[i][landObjects][x], objectInfo[x][oRotX], objectInfo[x][oRotY], objectInfo[x][oRotZ]);
objectInfo[x][oDoorOpen] = 1;
}
}
else SendClientMessage(playerid, COLOR_GREY, "You do not own this land or have permission to open this door");
}
else if(objectInfo[x][oDoor] == 2)
{
if(strcmp(playername, LandInfo[i][landOwner], true) == 0 || PlayerInfo[playerid][pLandPerms] >= 1 && PlayerInfo[playerid][pEditLand] == i || TempLandPerm[playerid] == i)
{
if(objectInfo[x][oDoorOpen] == 0)
{
MoveDynamicObject(LandInfo[i][landObjects][x], Pos[0], Pos[1], Pos[2]+3, 50.0, Rot[0], Rot[1], 90.0);
objectInfo[x][oDoorOpen] = 0;
}
else
{
MoveDynamicObject(LandInfo[i][landObjects][x], objectInfo[x][oPosX], objectInfo[x][oPosY], objectInfo[x][oPosZ], 50.0, objectInfo[x][oRotX], objectInfo[x][oRotY], objectInfo[x][oRotZ]);
objectInfo[x][oDoorOpen] = 1;
}
}
else SendClientMessage(playerid, COLOR_GREY, "You do not own this land or have permission to open this door.");
}
}
}
}
}
}
// END OF LAND DOORS!
}
return 1;
}