SA-MP Forums Archive
Distance Shoot - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Distance Shoot (/showthread.php?tid=545099)



Distance Shoot - Hostoxide - 06.11.2014

How to get distance shoot ?

like Hostoxide killed you within 100 meters


Re: Distance Shoot - scout322 - 06.11.2014

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    new Float:x, Float:y, Float:z, Float:Distance;
    GetPlayerPos(damagedid, x, y, z);
    Distance = GetPlayerDistanceFromPoint(playerid, x,y,z);
    return 1;
}
Something like this. I hope it helped


Re: Distance Shoot - scout322 - 06.11.2014

You can delete Float: form distance if you want. I dont know is thats needed


Re: Distance Shoot - Anzipane - 06.11.2014

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if (killerid != INVALID_PLAYER_ID)
    {
        new Float:coords[3];
        GetPlayerPos(playerid, coords[0], coords[1], coords[2]);
        format(str, sizeof(str), "You've been killed (Distance: %.2f meters).", GetPlayerDistanceFromPoint(killerid, coords[0], coords[1], coords[2]);
        SendClientMessage(playerid, -1, str);
    }
   
    return 1;
}