GetDistanceBetweenPlayers
new Float:x, Float:y, Float:z;
GetPlayerPos(damagedid, x, y, z);
new Float: distancia = GetPlayerDistanceFromPoint(playerid, x, y, z);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
{
new Float:Distancia, string[100];
Distancia = GetDistanceBetweenPlayers(issuerid,playerid);
format(string, sizeof(string), "[ INFO ] vocк deu um tiro no jogador %s em uma distancia de %.1f", PlayerName(playerid), Distancia);
SendClientMessage(issuerid, -1, string);
}
return 1;
}
stock PlayerName(playerid)
{
new Nome[MAX_PLAYERS];
GetPlayerName(playerid, Nome, MAX_PLAYERS);
return Nome;
}
stock GetDistanceBetweenPlayers(playerid,playerid2){
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:dis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(dis);
}
if(weaponid == 34)
{
if(damagedid != INVALID_PLAYER_ID)
{
new string[128], hitado[MAX_PLAYER_NAME];
GetPlayerName(damagedid, hitado, sizeof (hitado));
new Float:x, Float:y, Float:z;
GetPlayerPos(damagedid, x, y, z);
new Float: distancia = GetPlayerDistanceFromPoint(playerid, x, y, z);
format(string, sizeof(string), "{B50909}[H.I.T] {FFFFFF}Hit confirmando em:{17A80F}%s[%d]:{FFFFFF}Distancia {17A80F}.:%d Feet(s) [Danos: %d]",hitado, damagedid, distancia, amount);
SendClientMessage(playerid , 0xFFFFFFFF, string);
}
}
jimmmy o meu iria funcionar corretamente ?
pawn Код:
|
if(damagedid != INVALID_PLAYER_ID)
new Float: distancia = GetPlayerDistanceFromPoint(playerid, x, y, z);
outros ...