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



Powerful Punch - Peveral - 07.05.2017

Hey guys...Iam new in Scripting...I have some factions like vampire , Werewolf and etc...I want Vampires to have powerful punch...But i dont know how can i set if vampire punches someone, his Hp gets more low...
I need to know how can i get that Vampire's Faction....
So alittle help...
This is my code
PHP Code:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
                    if(
PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == 9)//Here is the Problem cuz its only for player who takes Damage..Not for the one who gives damage...
            
{
            new 
Float:hp;
        
                   if(
weaponid == 0)
                {
                    
GetPlayerHealth(playeridhp), hp-=30SetPlayerHealth(playeridhp);
                }
                }
            
            return 
1;
            } 



Re: Powerful Punch - moura98 - 07.05.2017

Use this callback
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage


Re: Powerful Punch - Peveral - 08.05.2017

Thanks it helped...
Is there a any way to directly change punch power...Like even lights break with one powerful punch?


Re: Powerful Punch - GTLS - 08.05.2017

Alternatively, you can use OnPlayerKeyStateChange() and find if he presses the Secondary_Fire key while on foot, the near by person's HP will be reduced to 0.

PHP Code:
Callback OnPlayerKeyStateChange()
HP GetPlayerHealthSetPlayerHealth
DIstance from player 
GetClosestPlayer 
Click Here for GetClosestPlayer Help.

EDIT:
After your post, i think you meant the lights for Car. you can use SetVehicleParams or may be SetVehicleHealth to add Extra Damage to Vehicles. You also need GetClosestVehicle(), try googling it out.


Re: Powerful Punch - Peveral - 08.05.2017

Quote:
Originally Posted by GTLS
View Post
Alternatively, you can use OnPlayerKeyStateChange() and find if he presses the Secondary_Fire key while on foot, the near by person's HP will be reduced to 0.

PHP Code:
Callback OnPlayerKeyStateChange()
HP GetPlayerHealthSetPlayerHealth
DIstance from player 
GetClosestPlayer 
Click Here for GetClosestPlayer Help.

EDIT:
After your post, i think you meant the lights for Car. you can use SetVehicleParams or may be SetVehicleHealth to add Extra Damage to Vehicles. You also need GetClosestVehicle(), try googling it out.
Hmmm...Yea that will work too..Thanks.
Yea that will be good for vehicles...But i meant that lights near streets you know...If there is anyways to break them with one punch or something like that...


Re: Powerful Punch - GTLS - 08.05.2017

Quote:
Originally Posted by Peveral
View Post
Hmmm...Yea that will work too..Thanks.
Yea that will be good for vehicles...But i meant that lights near streets you know...If there is anyways to break them with one punch or something like that...
idk if it detects it for Original Objects. may be with Custom Objects you can use Sound effects and DestroyObject with a Timer to make it look good.