When shot apply an animation? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: When shot apply an animation? (
/showthread.php?tid=192697)
When shot apply an animation? -
DaneAMattie - 23.11.2010
How do i make it, that if a player gets hit with a certain weapon (like silenced pistol) it apply's an animation.
Re: When shot apply an animation? -
dark_clown - 23.11.2010
getplayerweapon then if player weapon is IdOfSilenced applyanimation....
Re: When shot apply an animation? -
Zh3r0 - 23.11.2010
Quote:
Originally Posted by dark_clown
getplayerweapon then if player weapon is IdOfSilenced applyanimation....
|
He clearly stated, that if the player GETS shot by a Silenced Pistol, not when he switches to the pistol..
Re: When shot apply an animation? -
DaneAMattie - 23.11.2010
indeed :P
Re: When shot apply an animation? -
Zh3r0 - 23.11.2010
Quote:
Originally Posted by DaneAMattie
indeed :P
|
You can use a combination of IsPlayerLookingAt and OnPlayerKeyStateChange.
I actually don't know how, maybe i do, maybe not.
I'm just giving a tip.
Re: When shot apply an animation? -
sekol - 23.11.2010
Ermm, IsPlayerAimingAtPlayer (Hmm, there was a function like this, i used something like that before) and check if player pressed FIRE key... This should do, but i'm not sure. I've got a big scripting break
Re: When shot apply an animation? -
DaneAMattie - 23.11.2010
oke thanks for the reply's i will try something with those functions, if its not working i repost here
Re: When shot apply an animation? -
DaneAMattie - 24.11.2010
i tried
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
for(new targetplayerid; targetplayerid<MAX_PLAYERS; targetplayerid++)
{
if(IsPlayerAimingAtPlayer(playerid,targetplayerid) && GetPlayerWeapon(playerid) == 23)
{
if(PlayerInfo[playerid][Tazer] == 1)
{
GameTextForPlayer(targetplayerid,"You have been tazed by a cop!",3000,3);
ApplyAnimation(targetplayerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1);
}
}
}
}
return 1;
}
but now every player gets tazed :S
Re: When shot apply an animation? -
TheXIII - 24.11.2010
Quote:
Originally Posted by DaneAMattie
i tried
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) { for(new targetplayerid; targetplayerid<MAX_PLAYERS; targetplayerid++) { if(IsPlayerAimingAtPlayer(playerid,targetplayerid) && GetPlayerWeapon(playerid) == 23) { if(PlayerInfo[playerid][Tazer] == 1) { GameTextForPlayer(targetplayerid,"You have been tazed by a cop!",3000,3); ApplyAnimation(targetplayerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1); } } } } return 1; }
but now every player gets tazed :S
|
Seems like the IsPlayerAimingAtPlayer function doesn't work correctly.
Re: When shot apply an animation? -
DaneAMattie - 24.11.2010
Quote:
Originally Posted by TheXIII
Seems like the IsPlayerAimingAtPlayer function doesn't work correctly.
|
indeed, well i used this one:
https://sampforum.blast.hk/showthread.php?tid=140765