21.12.2010, 09:27
Primeiramente ponha isto no comeзo do seu gamemode ou filter script:
Agora fora de alguma callback do seu gamemode ponha isto:
Agora para por a proximidade necessitarб por o seguinte cуdigo:
pawn Код:
forward Detectarproximidade(Float:radi, playerid, string[], color);
pawn Код:
public Detectarproximidade(Float:radi,playerid,string[],color)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, color, string);
}
}
else
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
pawn Код:
new string[56];
format(string, sizeof(string), "...");
Detectarproximidade(2.0, playerid, string, cor);

