Help me [+REP]
#1

Hello i have seen something to SAMP
I was use shootgun on my server and from long distance he have a low damage and from less distance have big damage.
i want disable this.
how to do that
Reply
#2

BUMP
Reply
#3

Hello!

Can you show us your callback OnPlayerTakeDamage and OnPlayerGiveDamage, please?
Reply
#4

You have to make custom damage system for your server, I think the below codes have to do the job for you...

PHP код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
   if(
IsPlayerConnected(playerid) && IsPlayerConnected(damagedid)) {
      new 
Float:Health,Float:Armour;
      
GetPlayerArmour(damagedid, Armour);
      if(
Armour > 0.0)
      {
         
SetPlayerArmour(damagedid, Armour+amount);
      }
      else
      {
         
GetPlayerHealth(damagedid, Health);
         
SetPlayerHealth(damagedid, Health+amount);
      }
      if(
GetPlayerWeapon(playerid) == /* weapon id you want here */)
      {
         
GivePlayerDamage(damagedid, 15.0);
      }
   }
}

GivePlayerDamage(playerid, Float:Amount) {
   new 
Float:Health,Float:Armour, Float:checker;
   
GetPlayerArmour(playerid, Armour);
   
GetPlayerHealth(playerid, Health);
   if(
Armour > 0.0)
   {
      
checker = Armour-Amount;
      if(
checker < 0.0)
      {
         
SetPlayerArmour(playerid, 0);
         
SetPlayerHealth(playerid, Health-checker);
      }
      else
      {
         
SetPlayerArmour(playerid, checker);
      }
   }
   else
   {
      
checker = Health-Amount;
      
SetPlayerHealth(playerid, checker);
   }
   
} 
Reply
#5

Quote:
Originally Posted by jlalt
Посмотреть сообщение
You have to make custom damage system for your server, I think the below codes have to do the job for you...

PHP код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
   if(
IsPlayerConnected(playerid) && IsPlayerConnected(damagedid)) {
      new 
Float:Health,Float:Armour;
      
GetPlayerArmour(damagedid, Armour);
      if(
Armour > 0.0)
      {
         
SetPlayerArmour(damagedid, Armour+amount);
      }
      else
      {
         
GetPlayerHealth(damagedid, Health);
         
SetPlayerHealth(damagedid, Health+amount);
      }
      if(
GetPlayerWeapon(playerid) == /* weapon id you want here */)
      {
         
GivePlayerDamage(damagedid, 15.0);
      }
   }
}
GivePlayerDamage(playerid, Float:Amount) {
   new 
Float:Health,Float:Armour, Float:checker;
   
GetPlayerArmour(playerid, Armour);
   
GetPlayerHealth(playerid, Health);
   if(
Armour > 0.0)
   {
      
checker = Armour-Amount;
      if(
checker < 0.0)
      {
         
SetPlayerArmour(playerid, 0);
         
SetPlayerHealth(playerid, Health-checker);
      }
      else
      {
         
SetPlayerArmour(playerid, checker);
      }
   }
   else
   {
      
checker = Health-Amount;
      
SetPlayerHealth(playerid, checker);
   }
   
} 
I'm pretty sure that will cause bugs.

https://sampforum.blast.hk/showthread.php?tid=563387
Reply


Forum Jump:


Users browsing this thread: