Drunk Player Walking -
playadeseville - 05.05.2015
Hello, i want to do that when a player is drunk he walks with DRUNK anim.
My problem is to detect when player is moving ( W A S D), i mean that he can't run/walk, when he tries to do everything the script forces him DRUNK walk animation.
Anyone can help me? I'm trying to do this but it's bugging everything.
Re: Drunk Player Walking -
TakeiT - 05.05.2015
This is all you need, apply it when the player drinks.
https://sampwiki.blast.hk/wiki/SetPlayerDrunkLevel
Re: Drunk Player Walking -
playadeseville - 05.05.2015
Quote:
Originally Posted by TakeiT
|
Nope, because SetPlayerDrunkLevel just makes your visual move.
I would like that when the player moves (W - A - S - D) the drunk walk style animation applies on him,
but not only when pressing ALT, but also when running / sprinting.
Please help me.
Re: Drunk Player Walking -
MP2 - 05.05.2015
http://lmgtfy.com/?q=samp+drunk+animation
Re: Drunk Player Walking -
playadeseville - 05.05.2015
I already have got the drunk animation.
Why don't you read?
I am looking a way to let the player moves when he's drunk, so when he wants to stop walking there's no anim on him.
Re: Drunk Player Walking -
MP2 - 05.05.2015
Sorry, I clearly didn't read that properly.
You need to detect the W/A/S/D keys (or arrow keys) with GetPlayerKeys under OnPlayerUpdate. If they press W or S - apply anim. If they release W/S - stop anim.
Re: Drunk Player Walking -
playadeseville - 05.05.2015
Quote:
Originally Posted by MP2
Sorry, I clearly didn't read that properly.
You need to detect the W/A/S/D keys (or arrow keys) with GetPlayerKeys under OnPlayerUpdate. If they press W or S - apply anim. If they release W/S - stop anim.
|
Tried to, but it bugs my player...
Re: Drunk Player Walking -
MP2 - 05.05.2015
Can you elaborate please? How do you mean it bugs your player?
Re: Drunk Player Walking -
playadeseville - 05.05.2015
That's what i did.. seems not working. The bug was mine mistake sorry
Код:
CheckWalk(playerid) {
new keys, updown, leftright;
GetPlayerKeys(playerid, keys, updown, leftright);
if(LegShooted[playerid] == 1) {
if ((keys == KEY_UP) || (keys == KEY_DOWN) || (keys == KEY_LEFT) || (keys == KEY_RIGHT))
{
ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
}
}
else if(Giocatore[playerid][pDrunk] == 1) {
if ((keys && updown & KEY_UP) || (keys && updown & KEY_DOWN) || (keys && leftright & KEY_LEFT) || (keys && leftright & KEY_RIGHT))
{
ApplyAnimation(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
}
}
}
public OnPlayerUpdate(playerid) {
CheckWalk(playerid);
}
Re: Drunk Player Walking -
MP2 - 05.05.2015
The 'keys' variable doesn't store U/D/L/R. That's what the 'updown' and 'leftright' variables are for.
pawn Код:
if(leftright == KEY_LEFT || leftright == KEY_RIGHT)
{
// They are holding left or right
}
Or alternatively...
pawn Код:
if(leftright) // Not false (0)
{
// They are holding left or right
}
Also, you want to check if they just STARTED to hold a key, you don't want to keep applying the animation. So to do this, you need to get their old key state (save it in variables).