Why is it happening that sometimes i just spawn stuck in sky... and cant go down..
and when everything is fine, like plane and all.. and when i land.. still got that velocity that drags me down..
but code seems fine to me.
PHP Code:
public client_PreThink( id )
{
if( ! is_user_alive( id ) )
return PLUGIN_CONTINUE;
if( g_bIsPlayerInParachute[ id ] )
{
new Float:fVelocity[ 3 ];
pev( id, pev_velocity, fVelocity );
if( ! g_bLandedPlayer[ id ] && ( ( pev( id, pev_flags ) & FL_ONGROUND ) || ( pev( id, pev_flags ) & FL_INWATER ) ) ) // player has landed on ground/ in water
{
g_bIsPlayerInParachute[ id ] = false; // not in parachute anymore
set_pev( id, pev_sequence, detach );
set_pev( id, pev_solid, SOLID_SLIDEBOX );
set_pev( id, pev_movetype, MOVETYPE_WALK );
ReLocatePlayer( id );
set_user_rendering( id );
client_cmd( id, "spk sound/%s", g_iSounds[ Landing_Sound ] ); // emit landing sound
g_bLandedPlayer[ id ] = true;
}
else if( fVelocity[ 2 ] < 0.0 ) // still in air
{
fVelocity[ 2 ] = g_fCachedParachuteVelocity;
set_pev( id, pev_velocity, fVelocity );
}
}
return PLUGIN_CONTINUE;
}