SA-MP Forums Archive
Weapon Anim with no UsePlayerPedAnims - 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: Weapon Anim with no UsePlayerPedAnims (/showthread.php?tid=629171)



Weapon Anim with no UsePlayerPedAnims - weex - 21.02.2017

Someone could help me to fix my script?

I want to:
In my server players when using hevy weapons, they do animation...
Like on UsePlayerPedAnims();
But without this...

I tried this:
Код:
public OnPlayerUpdate(playerid) 
{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) 
	{
		new w = GetPlayerWeapon(playerid);
		if(w == 25 || w == 27 || w == 30 || w == 31 || w == 33 || w == 34) {
			if(GetPlayerSpeed(playerid, true) >= 1) {
				ApplyAnimation(playerid, "PED", "RUN_ARMED", 4.1, 0, 1, 1, 0, 0);
			}
			else {
				ApplyAnimation(playerid, "PED", "IDLE_ARMED", 4.1, 0, 1, 1, 0, 0);
			}
		}
	}
	return 1;
}
But it's not work well...
Players are freezed using animation...

Like this
if(GetPlayerSpeed(playerid, true) >= 1) {
ApplyAnimation(playerid, "PED", "RUN_ARMED", 4.1, 0, 1, 1, 0, 0);
}
Run the anim with no stop, can not even move to another direction


Re: Weapon Anim with no UsePlayerPedAnims - maikons - 22.02.2017

Lol run with:
Код:
ApplyAnimation(playerid, "PED", "RUN_ARMED", 4.1, 0, 1, 1, 0, 0);
Or be idle with:
Код:
ApplyAnimation(playerid, "PED", "IDLE_ARMED", 4.1, 0, 1, 1, 0, 0);
Using:
Код:
UsePlayerPedAnims();
Should be amazing...
There is a way to do this?


Re: Weapon Anim with no UsePlayerPedAnims - weex - 22.02.2017

I tried this too:
Код:
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) 
	{
		new w = GetPlayerWeapon(playerid);
		if(w == 25 || w == 27 || w == 30 || w == 31 || w == 33 || w == 34) {
			if(GetPlayerSpeed(playerid, true) >= 1) {
				if(GetPlayerAnimationIndex(playerid) != 1223) ApplyAnimation(playerid, "PED", "RUN_ARMED", 4.1, 0, 1, 1, 0, 0);
			}
			else {
				if(GetPlayerAnimationIndex(playerid) != 1183) ApplyAnimation(playerid, "PED", "IDLE_ARMED", 4.1, 0, 1, 1, 0, 0);
			}
		}
	}
But still freezing, looping animations and players can not walk write on server..


Re: Weapon Anim with no UsePlayerPedAnims - Unte99 - 22.02.2017

https://sampwiki.blast.hk/wiki/OnPlayerUpdate

Quote:

This callback is called, on average, 30 times per second, per player; only use it when you know what it's meant for (or more importantly what it's NOT meant for).

You are setting the animation for a player 30 times/s.


Re: Weapon Anim with no UsePlayerPedAnims - maikons - 23.02.2017

Quote:
Originally Posted by Unte99
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/OnPlayerUpdate



You are setting the animation for a player 30 times/s.
But why it's repeating with this if?
if(GetPlayerAnimationIndex(playerid) != 1223) ~~ if(GetPlayerAnimationIndex(playerid) != 1183)


Re: Weapon Anim with no UsePlayerPedAnims - maikons - 24.02.2017

Quote:
Originally Posted by maikons
Посмотреть сообщение
But why it's repeating with this if?
if(GetPlayerAnimationIndex(playerid) != 1223) ~~ if(GetPlayerAnimationIndex(playerid) != 1183)
?