13.07.2016, 12:04
pawn Код:
CMD:movedoor(playerid, params[])
{
#pragma tabsize 0
for(new i = 0; i < MAX_LANDS; i++)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(IsPlayerInGangZone(playerid, LandInfo[i][landZone]))
{
for(new x = 0; x < 251; x ++)
{
new Float:Positions[3], Float:Rotations[3];
if(IsValidDynamicObject(LandInfo[i][landObjects][x]))
{
GetDynamicObjectPos(LandInfo[i][landObjects][x], Positions[0], Positions[1], Positions[2]);
GetDynamicObjectRot(LandInfo[i][landObjects][x], Rotations[0], Rotations[1], Rotations[2]);
if(IsPlayerInRangeOfPoint(playerid, Positions[0], Positions[1], Positions[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], Rotations[0], 90.0, Rotations[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], Positions[0], Positions[1], Positions[2]+3, 50.0, Rotations[0], Rotations[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.");
}
}
}
}
}
}
return 1;
}