SA-MP Forums Archive
Help me [+REP] - 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: Help me [+REP] (/showthread.php?tid=611588)



Help me [+REP] - XStreeter - 08.07.2016

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


Re: Help me [+REP] - XStreeter - 08.07.2016

BUMP


Re: Help me [+REP] - Mencent - 08.07.2016

Hello!

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


Re: Help me [+REP] - jlalt - 08.07.2016

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(playeriddamagedidFloatamountweaponidbodypart)
{
   if(
IsPlayerConnected(playerid) && IsPlayerConnected(damagedid)) {
      new 
Float:Health,Float:Armour;
      
GetPlayerArmour(damagedidArmour);
      if(
Armour 0.0)
      {
         
SetPlayerArmour(damagedidArmour+amount);
      }
      else
      {
         
GetPlayerHealth(damagedidHealth);
         
SetPlayerHealth(damagedidHealth+amount);
      }
      if(
GetPlayerWeapon(playerid) == /* weapon id you want here */)
      {
         
GivePlayerDamage(damagedid15.0);
      }
   }
}

GivePlayerDamage(playeridFloat:Amount) {
   new 
Float:Health,Float:ArmourFloat:checker;
   
GetPlayerArmour(playeridArmour);
   
GetPlayerHealth(playeridHealth);
   if(
Armour 0.0)
   {
      
checker Armour-Amount;
      if(
checker 0.0)
      {
         
SetPlayerArmour(playerid0);
         
SetPlayerHealth(playeridHealth-checker);
      }
      else
      {
         
SetPlayerArmour(playeridchecker);
      }
   }
   else
   {
      
checker Health-Amount;
      
SetPlayerHealth(playeridchecker);
   }
   




Re: Help me [+REP] - SickAttack - 08.07.2016

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(playeriddamagedidFloatamountweaponidbodypart)
{
   if(
IsPlayerConnected(playerid) && IsPlayerConnected(damagedid)) {
      new 
Float:Health,Float:Armour;
      
GetPlayerArmour(damagedidArmour);
      if(
Armour 0.0)
      {
         
SetPlayerArmour(damagedidArmour+amount);
      }
      else
      {
         
GetPlayerHealth(damagedidHealth);
         
SetPlayerHealth(damagedidHealth+amount);
      }
      if(
GetPlayerWeapon(playerid) == /* weapon id you want here */)
      {
         
GivePlayerDamage(damagedid15.0);
      }
   }
}
GivePlayerDamage(playeridFloat:Amount) {
   new 
Float:Health,Float:ArmourFloat:checker;
   
GetPlayerArmour(playeridArmour);
   
GetPlayerHealth(playeridHealth);
   if(
Armour 0.0)
   {
      
checker Armour-Amount;
      if(
checker 0.0)
      {
         
SetPlayerArmour(playerid0);
         
SetPlayerHealth(playeridHealth-checker);
      }
      else
      {
         
SetPlayerArmour(playeridchecker);
      }
   }
   else
   {
      
checker Health-Amount;
      
SetPlayerHealth(playeridchecker);
   }
   

I'm pretty sure that will cause bugs.

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