Weapon Anim with no UsePlayerPedAnims
#1

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
Reply
#2

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?
Reply
#3

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..
Reply
#4

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.
Reply
#5

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)
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)