Raised This Month: $ Target: $400
 0% 

Solved Making an entity levitate and player follow it


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-17-2018 , 20:30   Re: Making an entity levitate and player follow it
Reply With Quote #9

I don't know what you mean with levitate, but you can just set the plane:

- Origin
- View angle (to the direction)
- And pev_velocity

For make players follow the plane, you just need set them the same vectors of the plane and set their gravity and maxspeed to 0. (can't fall and can't move inside the plane).

That's the code I'm using on my Battleground to create the plane:

PHP Code:
public createPlane()
{
    new 
Float:fOrigin[3], Float:fAngle[3], Float:fVelocity[3]
    
getRandomPlaneDirection(fOriginfAnglefVelocity//the code that gets four random directions

    
new iEnt fm_create_entity("info_target")
    
fm_create_ent
    
(
        
iEnt
        
g_szClassNamesData[cTransporter], 
        
g_szModelsData[mTransporter], 
        
fOrigin,
        
fVelocity,
        
fAngle
    
// code to create the plane
    
    
g_bPlaneSpanwed true
    g_iEnt
[pPlaneTransporter] = iEnt
    fOrigin
[2] -= 40.0 // players under the plane.
    
    
new iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"ach")
    for(new 
iid;iNum;i++)
    {
        
id iPlayers[i]
        
        
setInvisibility(idtrue// for players can't be seen by their enemies.
        
client_cmd(id"spk ^"%s^""g_szSoundsData[sTransporter]) // sound of the plane
        
                //here are all vectors for players be able to follow the plane
        
set_pev(idpev_originfOrigin// Same origin of the plane
        
set_pev(idpev_anglesfAngle// Same direction of the plane
        
set_pev(idpev_fixangle1// Fix the angle 
        
set_pev(idpev_velocityfVelocity// Same velocity of the plane
        
set_pev(idpev_gravity0.000001//Can't fall
        
set_pev(idpev_maxspeed0.000001//Can't move

              // some booleans to use later.
        
g_dUserData[id][bIsOnPlane] = true
        g_dUserData
[id][bCanUseParachute] = false
    
}
    
        
// to remove the plane
    
set_task(PLANE_REMOVE_TIME"checkPlaneOrigin"TASK_PLANE)

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

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

Last edited by EFFx; 07-17-2018 at 20:38.
EFFx is offline
 



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 12:26.


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