Shooting distance?
#5

Use the callbacks such as "OnPlayerGiveDamage" and "OnPlayerTakeDamage" to do that. And if you want to lower the damage being done than default damage, I suggest you to set player's team and then manage the damage. While using these callbacks, use GetPlayerDistanceFromPoint function to determine how meters you're away from the player.


For 3z:
Use OnPlayerWeaponShot. And here's an example:

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == HIT_TYPE_PLAYER)
    {
        new
            Float:X, Float:Y, Float:Z;
        GetPlayerPos(hitid, X, Y, Z);
        if(GetPlayerDistanceFromPoint(playerid, X, Y, Z) < 4.0)
        {
            //More damage?
        }
        else
        {
            //If more than 3m.
        }
    }
    return 1;
}
The same can be done on with "OnPlayerGiveDamage" or "OnPlayerTakeDamage" in case if it's not for 3x or for 3z versions with lagcompmode Off.
Reply


Messages In This Thread
Shooting distance? - by Lajko1 - 12.03.2014, 18:21
Re: Shooting distance? - by JonathanFeitosa - 12.03.2014, 18:26
Re: Shooting distance? - by Matess - 12.03.2014, 18:32
Re: Shooting distance? - by Lajko1 - 12.03.2014, 18:53
Re: Shooting distance? - by Lordzy - 12.03.2014, 18:56
Re: Shooting distance? - by Lajko1 - 12.03.2014, 18:59
Re: Shooting distance? - by Matess - 12.03.2014, 18:59
Re: Shooting distance? - by CuervO - 12.03.2014, 21:16

Forum Jump:


Users browsing this thread: 1 Guest(s)