Fightstyle Problem - 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: Fightstyle Problem (
/showthread.php?tid=516005)
Fightstyle Problem -
cedizon - 29.05.2014
When i used the Kick Boxing Fight Style I damaged half of Players Life , how to changed it to normal damage like at Normal FightStyle?
Re: Fightstyle Problem -
Barnwell - 29.05.2014
/fightstyle or /setfightstyle if you are admin
Re: Fightstyle Problem -
cedizon - 29.05.2014
@Barnwell , i mean how to change the damage of Kick Boxing Fight Style same as Normal FightStyle Damage?
Re: Fightstyle Problem -
Lynn - 29.05.2014
You can't change how much damage they do.
Re: Fightstyle Problem -
Rittik - 29.05.2014
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
if(GetPlayerWeapon(playerid)==0)
{
if(GetPlayerFightingStyle(playerid)==7) // '7' is for FIGHT_STYLE_KNEEHEAD
{
SetPlayerHealth(damagedid,GetPlayerHealth(damagedid)-5.0);
}
}
return 1;
}
Re: Fightstyle Problem -
NaClchemistryK - 29.05.2014
Quote:
Originally Posted by Rittik
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
if(GetPlayerWeapon(playerid)==0)
{
if(GetPlayerFightingStyle(playerid)==7) // '7' is for FIGHT_STYLE_KNEEHEAD
{
SetPlayerHealth(damagedid,GetPlayerHealth(damagedid)-5.0);
}
}
return 1;
}
|
This code should take half of the player's life, + -5.0 of his health.
Surprised that your indentation is a little better..
You should rather use a positive value. Otherwise he will just get more damage.
pawn Код:
if(GetPlayerFightingStyle(playerid)==7) // '7' is for FIGHT_STYLE_KNEEHEAD
{
SetPlayerHealth(damagedid,GetPlayerHealth(damagedid) + 45.0);
}
Re: Fightstyle Problem -
Rittik - 29.05.2014
Quote:
Originally Posted by NaClchemistryK
This code should take half of the player's life, + -5.0 of his health.
Surprised that your indentation is a little better..
You should rather use a positive value. Otherwise he will just get more damage.
pawn Код:
if(GetPlayerFightingStyle(playerid)==7) // '7' is for FIGHT_STYLE_KNEEHEAD { SetPlayerHealth(damagedid,GetPlayerHealth(damagedid) + 45.0); }
|
No offense but adding 45 will create a problem , cedizon wants to deduct some health as far as I know.
Re: Fightstyle Problem -
NaClchemistryK - 29.05.2014
Quote:
Originally Posted by Rittik
No offense
|
None taken.
Quote:
Originally Posted by Rittik
but adding 45 will create a problem , cedizon wants to deduct some health as far as I know.
|
Quote:
Kick Boxing Fight Style I damaged half of Players Life , how to changed it to normal damage like at Normal FightStyle?
|
Correct me if wrong, but the amount of damage given to a player is already built into samp. So if the kick boxing style really takes -50 health, then you should add 45 to it to get a -5 damage.
45 + (-50) = -5
Chemistry also has something to do with maths, ya know
Re: Fightstyle Problem -
Rittik - 29.05.2014
The word
'if' matters a lot here.Read the code very carefully brother.
If a player is using fighting style
7 then the player who is getting damaged, his/her health will be reduced by 5%
Re: Fightstyle Problem -
Threshold - 29.05.2014
His/her health will be reduced by 5% with the additional damage native to SA-MP, which doesn't solve anything and in fact just makes the problem worse. The only REAL way that you can solve this is by setting the players to the same team using SetPlayerTeam. This will disallow friendly fire within teams, so the player will natively do no damage at all. Then you can use OnPlayerGiveDamage etc. to calculate an appropriate deduction from the player's health when they are hit with a certain fighting style.
Note that this would affect all weapons and you would need to add callbacks like OnPlayerWeaponShot, OnPlayerTakeDamage etc.
To be honest, it really isn't worth all the hassle, just to stop all the damage from the fighting style. If it bothers you that much, just remove the fighting style.