09.03.2016, 13:35
Quote:
Oh i see!
![]() PHP код:
|
Quote:
In OnPlayerUpdate you need to check for the up/down and left/right keys, however that makes it even more slow.
To prevent making you not able to fall you also have to check the z velocity (adjust MAX_Z_VEL). It might be a bit buggy when jumping, holding jump makes it work. This works for me, even when sprinting and walking. On a server with a high ping it could be very laggy tho. Код:
#define SPEED_MUL 0.1 #define MAX_Z_VEL 0.02 public OnPlayerUpdate(playerid) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { new keys, ud, lr; GetPlayerKeys(playerid, keys, ud, lr); if((ud != 0 || lr != 0) && !(keys & KEY_JUMP)) { new Float:v0[3]; GetPlayerVelocity(playerid, v0[0], v0[1], v0[2]); if(v0[2] >= -MAX_Z_VEL && v0[2] <= MAX_Z_VEL) SetPlayerVelocity(playerid, v0[0] * SPEED_MUL, v0[1] * SPEED_MUL, v0[2] * SPEED_MUL); } } } |
and even mode of running is not fluid