//----------------------------------------------------------------
#include <a_samp>
forward area();
forward chiudi();
new cancello;
main(){}
public ongamemodeinit()
{
cancello=createobject(969, 2463.6999511719, -1656.9000244141, 12.39999961853, 0, 0, 266);
settimer("area",2500,true); //timer
return 1;
}
public area()
{
for(new playerid=0;playerid<max_players;playerid++)
{
if(isplayerinarea(playerid, 2463.6999511719-5,-1656.9000244141-5,2463.6999511719+5,-1656.9000244141+5)) return settimer("chiudi", moveobject(cancello, 2463.6999511719, -1656.9000244141, 12.39999961853, 1), false);
}
return 0;
}
public chiudi()
{
if(area()==0) moveobject(cancello, 2464.1999511719, -1650.4000244141, 12.5, 1); //coordinate x la chiusura del cancello
return 1;
}
stock isplayerinarea(playerid, float:min_x,float:min_y,float:max_x, float:max_y)
{
new float:x, float:y, float:z;
getplayerpos(playerid, x, y, z);
if(x <= max_x && x >= min_x && y <= max_y && y >= min_y) return 1;
return 0;
}
//-----------------------------------------------------------//