help distance kill
#1

how do I get this?
for example:
Player2 was killed by Player1 | (M4) | Player1 Health: 80 Armour: 0 Distance: 5.41 meter
thanks
Reply
#2

smth like that:

To OnPlayerDeath:
pawn Code:
new PlayerName[MAX_PLAYER_NAME],TargetName[MAX_PLAYER_NAME],string[128],Float:HP,Float:AP,weaponName[65];
GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
GetPlayerName(killerid,TargetName,sizeof(TargetName));
GetPlayerHealth(killerid,HP);
GetPlayerArmour(killerid,AP);
GetWeaponName(GetPlayerWeapon(killerid), weaponName, 64);
format(string,sizeof(string,"%s was killed by %s | (%s) | %s's Health: %f, Armour: %f Distance: %f meter",PlayerName,TargetName,TargetName,weaponName,HP,AP,GetDistancePlayertoPlayer(playerid,killerid));
SendClientMessageToAll(0xFFFF00FF,string);
To end of the mode:
pawn Code:
public Float:GetDistancePlayertoPlayer(playerid,playerid2)
{
 if(!IsPlayerConnected(playerid)) return 65000.0;
 if(!IsPlayerConnected(playerid2)) return 65000.0;
 new Float:x1, Float:y1, Float:z1;
 new Float:x2, Float:y2, Float:z2;
 GetPlayerPos(playerid,x1,y1,z1);
 GetPlayerPos(playerid2,x2,y2,z2);
 new Float:dist = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return dist;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)