Raised This Month: $32 Target: $400
 8% 

Solved Making an entity levitate and player follow it


Post New Thread Reply   
 
Thread Tools Display Modes
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-19-2018 , 07:09   Re: Making an entity levitate and player follow it
Reply With Quote #21

@EFFX

Every time I jump out from the plane, the plane stops and stays where it was.

PHP Code:
new g_iAirPlaneEnt;

new 
bool:g_bPlayerInPlane33 ];

public 
plugin_init( )
{
    
register_logevent"OnNewRound"2"1=Round_Start" );

    
RegisterHamHam_Player_Jump"player""@HamPlayerJump_Post");
}

public 
OnNewRound( )
{    
    
g_iAirPlaneEnt find_ent_by_class( -1AIRPLANE_CLASSNAME );
    
    if( 
pev_validg_iAirPlaneEnt ) )
    
engfuncEngFunc_RemoveEntityg_iAirPlaneEnt );

    
g_iAirPlaneEnt 0;
    
    
MakeAirPlane( );
    return 
PLUGIN_CONTINUE;
}

public @
HamPlayerJump_Postid )
{
    if( ! 
g_bPlayerInPlaneid ] )
    return 
HAM_IGNORED;

    
set_pevidpev_solidSOLID_SLIDEBOX );
    
set_pevidpev_movetypeMOVETYPE_TOSS );
    
    
g_bPlayerInPlaneid ] = false;
    
    
set_user_renderingid );
    
    
set_pevidpev_gravityDEFAULT_GRAVITY );
    
set_user_maxspeedidDEFAULT_MAXSPEED );
    
    
set_task1.0"OnDeployParachute"id+TASK_PARACHUTE_DEPLOY );
    
    return 
HAM_IGNORED;
}

MakeAirPlane( )
{
    new 
Float:fOrigin], Float:fAngle] , Float:fVelocity];
    
GetPlaneDirectionfOriginfAnglefVelocity ) ;
    
    
g_iAirPlaneEnt create_entity"info_target" );
    
    
set_pevg_iAirPlaneEntpev_classnameAIRPLANE_CLASSNAME );
    
set_pevg_iAirPlaneEntpev_solidSOLID_BBOX );
    
set_pevg_iAirPlaneEntpev_movetypeMOVETYPE_FLY );
    
engfuncEngFunc_SetModelg_iAirPlaneEntg_iDataAirPlaneAirPlane_Model ] );
    
engfuncEngFunc_SetOriging_iAirPlaneEntfOrigin );
    
set_pevg_iAirPlaneEntpev_anglesfAngle );
    
set_pevg_iAirPlaneEntpev_velocityfVelocity );
    
    
fOrigin] -= 5.0;
    
    new 
szPlayers32 ], iNumiTempID;
    
get_playersszPlayersiNum"ach" );
    
    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];
        
        
AttachPlayerToPlaneiTempIDfOriginfAnglefVelocity );
    }
}

AttachPlayerToPlaneidFloat:fOrigin], Float:fAngle], Float:fVelocity] )
{
    
set_user_renderingidkRenderFxGlowShell000kRenderTransAlpha);
    
    
engfuncEngFunc_SetOriginidfOrigin );
    
set_pevidpev_anglesfAngle );
    
set_pevidpev_fixangle);
    
set_pevidpev_velocityfVelocity );
    
set_pevidpev_gravity0.00001 );
    
set_pevidpev_maxspeed0.00001 );
    
    
g_bIsPlayerInParachuteid ] = false;
    
g_bPlayerInPlaneid ] = true;
    
    
set_pevidpev_solidSOLID_NOT );
}

GetPlaneDirectionFloat:fOrigin3] , Float:fAngle], Float:fVelocity] )
{
    
fOrigin] = 3983.9;
    
fOrigin] = -3983.9;
    
fOrigin] = 3931.9;
    
    
fAngle] = -0.6;
    
fAngle] = 133.5;
    
fAngle] = 0.0;
    
    
fVelocity] = -206.6;
    
fVelocity] = 217.2;
    
fVelocity] = -10.6;


Last edited by edon1337; 07-19-2018 at 07:21.
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-19-2018 , 07:29   Re: Making an entity levitate and player follow it
Reply With Quote #22

Make the plane SOLID_NOT or SOLID_TRIGGER, it possibly collides with the player. Is there any reason for it to be solid?
__________________

Last edited by klippy; 07-19-2018 at 07:29.
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-19-2018 , 07:42   Re: Making an entity levitate and player follow it
Reply With Quote #23

Quote:
Originally Posted by KliPPy View Post
Make the plane SOLID_NOT or SOLID_TRIGGER, it possibly collides with the player. Is there any reason for it to be solid?
Thanks, no, not really.
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-19-2018 , 12:44   Re: Making an entity levitate and player follow it
Reply With Quote #24

Quote:
You can maybe set the plane's solid type to SOLID_NOT too, so he has immunity to stuck in something.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 07-19-2018 at 12:45.
EFFx is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 07-19-2018 , 17:55   Re: Making an entity levitate and player follow it
Reply With Quote #25

Maybe XY problem. You want to recreate PUBG's airplane mechanics?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-19-2018 , 18:03   Re: Making an entity levitate and player follow it
Reply With Quote #26

Quote:
Originally Posted by meTaLiCroSS View Post
Maybe XY problem. You want to recreate PUBG's airplane mechanics?
Fixed already, and yes. Well, already did.

Last edited by edon1337; 07-19-2018 at 18:03.
edon1337 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 07-19-2018 , 20:37   Re: Making an entity levitate and player follow it
Reply With Quote #27

Quote:
Originally Posted by edon1337 View Post
Fixed already, and yes. Well, already did.
If that's the case, there exists better ways to realize this. You can fake players position (in an specific place, using follow + aiment trick, etc), use SetView, a different camera position, plane does not need to be a solid entity, and others
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode