Anim when shot
#1

i wanted to make a gta 3-like effect for shotgun - player falls on their back when hit, facing his enemy. i've made this:
Код:
	if(weaponid == 25)
	{
		if(!IsPlayerInAnyVehicle(playerid))
		{
	    	new Float:issuerangle;
    		GetPlayerFacingAngle(issuerid, issuerangle);
	    	SetPlayerFacingAngle(playerid, issuerangle+180);
		ApplyAnimation(playerid,"BASEBALL","Bat_Hit_3", 4.1, 0, 1, 1, 0, 1, 1);
		}
	}
but seems it doesn't work, nothing happens.

edit: i changed the code to:
Код:
	if(weaponid == 25)
	{
		if(!IsPlayerInAnyVehicle(playerid))
		{
	    	new Float:issuerangle;
    		GetPlayerFacingAngle(issuerid, issuerangle);
	    	SetPlayerFacingAngle(playerid, issuerangle+180);
	    	ClearAnimations(playerid);
			ApplyAnimation(playerid,"BASEBALL","Bat_Hit_3", 4.1, false, true, true, true, true);
		}
	}
.
now it works, but 50% of the time, the shooter cant see the victims anim. any ideas?
Reply
#2

OnPlayerTaleDamage (I think)
Reply
#3

You think what? This code is already there.
Reply
#4

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
now it works, but 50% of the time, the shooter cant see the victims anim. any ideas?
Did you preload the animation library, because if you haven't that'll be causing a sync issue, but it could also cause your first lot of code to appear not to work at all.



put this code

Код:
print("Debug");
in the if statements (Instead of Debug, something meaningful, like "Hit : Deagle") regarding where it hit in the code, using the weaponid to say where the code actually triggered.

This'll show it's a desync issue or not, and it will help out in showing you how to put debug messages in, to find where the faults actually are.


If it is desync and it is triggering, that means you need to preload the animations.

Код:
PreloadAnimLib
Reply
#5

Well, i tried this method, and debug message is showing everytime somebody got hit with a shotgun.
I tried PreloadAnimLib before setting the falling animation for player, but nothing changed. About 50% of time when i shoot the player, i can only see him floating back a little. He sees his own animation tho. Same goes with me.
Reply
#6

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
Well, i tried this method, and debug message is showing everytime somebody got hit with a shotgun.
I tried PreloadAnimLib before setting the falling animation for player, but nothing changed. About 50% of time when i shoot the player, i can only see him floating back a little. He sees his own animation tho. Same goes with me.
Have you tried applying the animation twice? Sometimes it helps with some animations. I know it sounds awkward but yeah.

Example:
PHP код:
ApplyAnimation(playerid,"BASEBALL","Bat_Hit_3"4.1falsetruetruetruetrue);
ApplyAnimation(playerid,"BASEBALL","Bat_Hit_3"4.1falsetruetruetruetrue); 
Reply
#7

Applying anim twice doesn't seem to work. I've also tried changing animation parameters, but still nothing.
Reply
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Did you preload the animation library, because if you haven't that'll be causing a sync issue, but it could also cause your first lot of code to appear not to work at all.



put this code

Код:
print("Debug");
in the if statements (Instead of Debug, something meaningful, like "Hit : Deagle") regarding where it hit in the code, using the weaponid to say where the code actually triggered.

This'll show it's a desync issue or not, and it will help out in showing you how to put debug messages in, to find where the faults actually are.


If it is desync and it is triggering, that means you need to preload the animations.

Код:
PreloadAnimLib
PreloadAnimLib isn't a native SA-MP function by the way.
Reply
#9

Quote:
Originally Posted by Abagail
Посмотреть сообщение
PreloadAnimLib isn't a native SA-MP function by the way.
Rather than handing things to people on a plate, I rather leave some for them to complete, so it's obvious they are learning, not simply "reading", "following instructions" or copying and pasting.
Reply
#10

Well, any other ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)