What function should i use? - 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: What function should i use? (
/showthread.php?tid=314228)
What function should i use? -
Shockey HD - 29.01.2012
Im making a script that, once somone shoots a person with the sniper, the persons health will be set to zero. I believe 0.3D has a function that lets me do so, if so, what is it?
Respuesta: What function should i use? -
admantis - 29.01.2012
Very simple!
pawn Код:
/* Works only for 0.3d*/
public OnPlayerTakeDamage( playerid, issuerid, Float: amount, weaponid )
{
if ( issuerid != INVALID_PLAYER_ID )
{
if ( GetPlayerWeapon( issuerid ) == 34 )
{
SetPlayerHealth( playerid, 0.0 );
SetPlayerArmour( playerid, 0.0 );
}
}
return 1;
}
Re: Respuesta: What function should i use? -
[HiC]TheKiller - 29.01.2012
Quote:
Originally Posted by admantis
Very simple!
pawn Код:
/* Works only for 0.3d*/ public OnPlayerTakeDamage( playerid, issuerid, Float: amount, weaponid ) { if ( issuerid != INVALID_PLAYER_ID ) { if ( GetPlayerWeapon( issuerid ) == 34 ) { SetPlayerHealth( playerid, 0.0 ); SetPlayerArmour( playerid, 0.0 ); } }
return 1; }
|
You don't actually need to use GetPlayerWeapon on the issuerid as there is a param for that in the function

.