Powerful Punch
#1

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;
            } 
Reply
#2

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

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

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.
Reply
#5

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...
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)