How to give damage? - 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: How to give damage? (
/showthread.php?tid=564397)
How to give damage? -
Nabster - 21.02.2015
I want to give 90 dmg when i launch anthrax,how can we give dmg to a player?
Re: How to give damage? -
davve95 - 21.02.2015
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
Re: How to give damage? -
CalvinC - 21.02.2015
Use
SetPlayerHealth to set a player's health, if you wan't to apply damage, use
GetPlayerHealth.
pawn Код:
new Float:health; // Creates a float called "health"
GetPlayerHealth(playerid, health); // Stores the player's health in the float "health"
SetPlayerHealth(playerid, health - 90); // Sets the player's health to the float "health" - 90
There are several callbacks where you can detect if the player damages another player, like
OnPlayerTakeDamage and
OnPlayerGiveDamage.
Re: How to give damage? -
JaydenJason - 21.02.2015
Quote:
Originally Posted by CalvinC
Use SetPlayerHealth to set a player's health, if you wan't to apply damage, use GetPlayerHealth.
pawn Код:
new Float:health; // Creates a float called "health" GetPlayerHealth(playerid, health); // Stores the player's health in the float "health" SetPlayerHealth(playerid, health - 90); // Sets the player's health to the float "health" - 90
There are several callbacks where you can detect if the player damages another player, like OnPlayerTakeDamage and OnPlayerGiveDamage.
|
Код:
SetPlayerHealth(playerid, health - 90.0);
Re: How to give damage? -
CalvinC - 21.02.2015
Quote:
Originally Posted by JaydenJason
Код:
SetPlayerHealth(playerid, health - 90.0);
|
There's no difference of 90 or 90.0.
Re: How to give damage? -
Antoniohl - 21.02.2015
Quote:
Originally Posted by JaydenJason
Код:
SetPlayerHealth(playerid, health - 90.0);
|
lol both works, there's no difference like he said
Re: How to give damage? -
Nabster - 21.02.2015
Yeah ty that worked