SA-MP Forums Archive
Sniper - 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: Sniper (/showthread.php?tid=419985)



Sniper - Fernado Samuel - 03.03.2013

Removed


Re: Sniper - RenSoprano - 03.03.2013

Use the Callback:
Код:
public OnPlayerShootPlayer(shooter,target,Float:damage)
And here is a simple example:

pawn Код:
public OnPlayerShootPlayer(shooter,target,Float:damage)
{
    new Float:HP;
    GetPlayerHealth(target, HP); // Here we will take the player current health
    if(GetPlayerWeapon(shooter) == 34) SetPlayerHealth(target, HP-100); // This will kill the target from 1 shoot
    return 1;
}



Re: Sniper - B-Matt - 03.03.2013

Use simple code for adjusting health and armour with damage.

Код:
Damage(playerid, Float:health, Float:armour, Float:damage)
{
	armour -= damage; //Will decrease
	if(armour <= 0.0) //if armour is lower or equal to 0.0 do..
	{
		armour = 0.0;
		health -= damage;
		if(health <= 0.0) health = 0.0;
	}
	SetPlayerHealth(playerid, health);
	SetPlayerArmour(playerid, armour);
}
Use in OnPlayerShootPlayer:

Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
        switch(GetPlayerWeapon(Shooter)) //Switchs shooters weaponid
        {
       		 case 34: {
			HealthAdjust(Target, HealthLost, ArmourLost, 35.0); } //Default weapon damage + your custom damage
	}
Code above is only for health damage and won't work if player have armour.


Re: Sniper - Tamer - 03.03.2013

Download this to use the post above:

http://forum.sa-mp.com/showthread.ph...yershootplayer