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]) { SendClientMessageA(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!"); } } } return 1; }
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; }
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; } |
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; }
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 10, -111.3551,1566.8140,17.5715))
{
if(IsGov(i) && duty[i]})
{
SendGovMessage(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!");
}
}
return 1;
}
SendGovMessage(color, string[]);
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnectedEx(i))
{
SendClientMessageA(i, color, string);
}
}
}
new bool:PlayerInPoint[MAX_PLAYERS char];
PlayerInPoint{playerid} = false;
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;
}
new messagesent[MAX_PLAYERS];
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])
{
if(messagesent[playerid] == 0)//added this
{
SendClientMessageA(i,COLOR_FACTION,"[Ground Detector] We have detected a vehicle heading towards Area 51! Intercept it!");
messagesent[playerid] =1;//this too
}
value{playerid}= false;
}
}else value{playerid} = true;
}
return 1;
}
You could use something like the streamer plugin or y_areas, which provide nice callbacks for when a player arrives near a point - to guarantee it only being called once.
|
A'right. I'll use streamer plugin.
Could you give me an exemple of what should I put ? |
OnPlayerEnterDynamicArea(playerid, areaid)
CreateDynamicCube(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);