Code:
CMD:moveit(playerid, params[])
{
// Dynamic Gates
new lan1,lan2;
lan1 = PlayerInfo[playerid][plan1];
lan2 = PlayerInfo[playerid][plan6];
for(new idx=lan1; idx<=lan2; idx++)
{
if(FurnitureInfo[idx][fModel] && IsPlayerInRangeOfPoint(playerid, 5, FurnitureInfo[idx][fX], FurnitureInfo[idx][fY], FurnitureInfo[idx][fZ]))
{
if(!FurnitureInfo[idx][fStatus])
{
FurnitureInfo[idx][fStatus] = 1;
MoveDynamicObject(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fOX], FurnitureInfo[idx][fOY], FurnitureInfo[idx][fOZ],FurnitureInfo[idx][fORX], FurnitureInfo[idx][fORY], FurnitureInfo[idx][fORZ], 10);
SetDynamicObjectRot(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fORX], FurnitureInfo[idx][fORY], FurnitureInfo[idx][fORZ]);
}
else
{
FurnitureInfo[idx][fStatus] = 0;
MoveDynamicObject(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fX], FurnitureInfo[idx][fY], FurnitureInfo[idx][fZ],FurnitureInfo[idx][fRX], FurnitureInfo[idx][fRY], FurnitureInfo[idx][fRZ], 10);
SetDynamicObjectRot(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fRX], FurnitureInfo[idx][fRY], FurnitureInfo[idx][fRZ]);
}
}
else
{
if(!FurnitureInfo[idx][fStatus])
{
FurnitureInfo[idx][fStatus] = 1;
MoveDynamicObject(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fOX], FurnitureInfo[idx][fOY], FurnitureInfo[idx][fOZ],FurnitureInfo[idx][fORX], FurnitureInfo[idx][fORY], FurnitureInfo[idx][fORZ], 10);
SetDynamicObjectRot(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fORX], FurnitureInfo[idx][fORY], FurnitureInfo[idx][fORZ]);
}
else
{
FurnitureInfo[idx][fStatus] = 0;
MoveDynamicObject(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fX], FurnitureInfo[idx][fY], FurnitureInfo[idx][fZ],FurnitureInfo[idx][fRX], FurnitureInfo[idx][fRY], FurnitureInfo[idx][fRZ], 10);
SetDynamicObjectRot(FurnitureInfo[idx][fObject], FurnitureInfo[idx][fRX], FurnitureInfo[idx][fRY], FurnitureInfo[idx][fRZ]);
}
}
idx = lan2;
return 1;
}
return 1;
}