Posts: 112
Threads: 8
Joined: Jan 2013
if an extra variable
new bool:value[MAX_PLAYERS char];
Код:
public OnPlayerUpdate(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
if(IsPlayerConnectedEx(i))
{
if(IsPlayerInRangeOfPoint(playerid, 10, -111.3551,1566.8140,17.5715) && value{playerid})
{
if(IsGov(i) && duty[i])
{
SendClientMessageA(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!");
value{playerid}= false;
}
}else value{playerid} = true;
}
return 1;
}
Posts: 112
Threads: 8
Joined: Jan 2013
i am sry
Код:
public OnPlayerUpdate(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
if(IsPlayerConnectedEx(i))
{
if(IsPlayerInRangeOfPoint(playerid, 10, -111.3551,1566.8140,17.5715))
{
if(IsGov(i) && duty[i] && value{playerid})
{
SendClientMessageA(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!");
value{playerid}= false;
}
}else value{playerid} = true;
}
return 1;
}
the problem on the code i posted before is that if the player is at the point the variable
is set for the player to false then if the timer call this statement again it call the else -statement because
the variable is set to false.
But to work with the Streamerplugin and the funktion CreateDynamicRectangle is a better idea
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
new bool:PlayerInPoint[MAX_PLAYERS char];
connect
pawn Код:
PlayerInPoint{playerid} = false;
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, -111.3551, 1566.8140, 17.5715))
{
if(!PlayerInPoint{playerid})
{
PlayerInPoint{playerid} = true;
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnectedEx(i))
if(IsGov(i) && duty[i])
SendClientMessageA(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!");
}
return 1;
}
PlayerInPoint{playerid} = false;
return 1;
}