help wot to get distance kill
#1

how can i get this ?
player1 killed player2. (desert) with 60 Health (Distance: 10m)
thanks
Reply
#2

pawn Код:
stock Float:GetDistanceBetweenPoints(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ) return floatsqroot(floatadd(floatadd(floatpower(floatsub(X, PointX), 2.0), floatpower(floatsub(Y, PointY), 2.0)), floatpower(floatsub(Z, PointZ), 2.0)));

stock Float:GetDistanceBetweenPlayers(playerid, otherplayerid)
{
new Float:X[2], Float:Y[2], Float:Z[2];
GetPlayerPos(playerid, X[0], Y[0], Z[0]);
GetPlayerPos(otherplayerid, X[1], Y[1], Z[1]);
return GetDistanceBetweenPoints(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
}
Reply
#3

and how to get the message on chat ?
Reply
#4

format(string, sizeof(string), "* Player %s killed %s! Distance: %.1f", killerid_name, playerid_name, GetDistanceBetweenPlayers(playerid, killerid));

And send it
Reply
#5

pawn Код:
new WeaponNames[][20] = {
{"Unarmed"},{"Brass Knuckles"},{"Golf Club"},{"Night Stick"},{"Knife"},{"Bat"},{"Shovel"},{"Pool Cue"},{"Katana"},{"Chainsaw"},{"Dildo"},{"Vibrator1"},{"Vibrator2"},{"Vibrator3"},{"Flowers"},{"Cane"},{"Grenade"},{"Tear Gas"},{"Molotov"},{" "},{"N/A"},{" "},{"Pistol"},
{"Silencer"},{"Deagle"},{"Shotgun"},{"Sawnoff"},{"Spas12"},{"Mac-10"},{"Mp5"},{"AK-47"},{"M4"},{"Tec-9"},{"Rifle"},{"Sniper"},{"RPG"},{"HeatSeeker"},{"Flamethrower"},{"Minigun"},{"Satchel"},{"Detonator"},{"Spraycan"},{"Extinguisher"},{"Camera"},{"Nightvision"},{"Infrared"},{"Parachute"},{" "},{" "},{"Vehicle Collision"},{"HeliKill"},{"Explosion"},{" "},{" "},{"Long Fall"}};
// Top Of Your Script Out Of Any CallBack

public OnPlayerDeath(playerid,killerid,reason)
{
  new
  PlayerNick[MAX_PLAYER_NAME],
  KillerNick[MAX_PLAYER_NAME],
  Float:H,
  Float:A,
  String[128];
  GetPlayerHealth(killerid,H);GetPlayerArmour(killerid,A);
  GetPlayerName(playerid, PlayerNick, MAX_PLAYER_NAME);
  GetPlayerName(killerid, KillerNick, MAX_PLAYER_NAME);
  format(String,sizeof(String),"*** %s Killed %s (%s) (HP : %.0f) (Dist : %.2f Ft)",KillerNick,PlayerNick,WeaponNames[reason],H+A,GetDistanceBetweenPlayers(playerid,killerid));
  SendClientMessageToAll(Colour,String);
  return 1;
}
Reply
#6

Quote:
Originally Posted by Killa_
pawn Код:
new WeaponNames[][20] = {
{"Unarmed"},{"Brass Knuckles"},{"Golf Club"},{"Night Stick"},{"Knife"},{"Bat"},{"Shovel"},{"Pool Cue"},{"Katana"},{"Chainsaw"},{"Dildo"},{"Vibrator1"},{"Vibrator2"},{"Vibrator3"},{"Flowers"},{"Cane"},{"Grenade"},{"Tear Gas"},{"Molotov"},{" "},{"N/A"},{" "},{"Pistol"},
{"Silencer"},{"Deagle"},{"Shotgun"},{"Sawnoff"},{"Spas12"},{"Mac-10"},{"Mp5"},{"AK-47"},{"M4"},{"Tec-9"},{"Rifle"},{"Sniper"},{"RPG"},{"HeatSeeker"},{"Flamethrower"},{"Minigun"},{"Satchel"},{"Detonator"},{"Spraycan"},{"Extinguisher"},{"Camera"},{"Nightvision"},{"Infrared"},{"Parachute"},{" "},{" "},{"Vehicle Collision"},{"HeliKill"},{"Explosion"},{" "},{" "},{"Long Fall"}};
// Top Of Your Script Out Of Any CallBack

public OnPlayerDeath(playerid,killerid,reason)
{
  new
  PlayerNick[MAX_PLAYER_NAME],
  KillerNick[MAX_PLAYER_NAME],
  Float:H,
  Float:A,
  String[128];
  GetPlayerHealth(killerid,H);GetPlayerArmour(killerid,A);
  GetPlayerName(playerid, PlayerNick, MAX_PLAYER_NAME);
  GetPlayerName(killerid, KillerNick, MAX_PLAYER_NAME);
  format(String,sizeof(String),"*** %s Killed %s (%s) (HP : %.0f) (Dist : %.2f Ft)",KillerNick,PlayerNick,WeaponNames[reason],H+A,GetDistanceBetweenPlayers(playerid,killerid));
  SendClientMessageToAll(Colour,String);
  return 1;
}
Yes, nice example 4 him :P
Reply
#7

thanks mates work but:
(1069) : warning 208: function with tag result used before definition, forcing reparse

1069tock Float:GetDistanceBetweenPlayers(playerid, otherplayerid)
{
new Float:X[2], Float:Y[2], Float:Z[2];
GetPlayerPos(playerid, X[0], Y[0], Z[0]);
GetPlayerPos(otherplayerid, X[1], Y[1], Z[1]);
return GetDistanceBetweenPoints(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
}

Reply
#8

put stock of this function above usage
Reply
#9

pawn Код:
stock Float:GetDistanceBetweenPoints(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ) return floatsqroot(floatadd(floatadd(floatpower(floatsub(X, PointX), 2.0), floatpower(floatsub(Y, PointY), 2.0)), floatpower(floatsub(Z, PointZ), 2.0)));

stock Float:GetDistanceBetweenPlayers(playerid, otherplayerid)
{
new Float:X[2], Float:Y[2], Float:Z[2];
GetPlayerPos(playerid, X[0], Y[0], Z[0]);
GetPlayerPos(otherplayerid, X[1], Y[1], Z[1]);
return GetDistanceBetweenPoints(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
}
Remove this from your script which Adas posted, its not necessary
Reply
#10

It is necessary! SA-MP have not default function like that. ach..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)