Raised This Month: $ Target: $400
 0% 

move entity from position to position with velocity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 02-23-2013 , 06:59   Re: move entity from position to position with velocity
Reply With Quote #4

simplyfied code , in the finished plugin I will use positions reading from datafile.....



Code:
public Action:Command_Air(client, args)
{
    new Float:Pos[3];
    new Float:Pos2[3];
    new Float:ang[3];   
    
    new AlliesEntity = -1;
    AlliesEntity = FindEntityByClassname(AlliesEntity, "info_player_allies");
    GetEntPropVector(AlliesEntity, Prop_Send, "m_vecOrigin", Pos);
    Pos[2] += 550.0;
    
    new AxisEntity = -1;
    AxisEntity = FindEntityByClassname(AxisEntity, "info_player_axis");    
    GetEntPropVector(AxisEntity, Prop_Send, "m_vecOrigin", Pos2);
    Pos2[2] += 550.0;        
    
    new entity=CreateEntityByName("prop_physics_override");
    if (IsValidEntity(entity))    
    {        
        
        DispatchKeyValue(entity,"model", g_Air);
        DispatchKeyValue(entity, "StartDisabled", "false");        
        DispatchKeyValue(entity,"SpawnFlags", "4");
        DispatchSpawn(entity);       
        AcceptEntityInput(entity , "EnableMotion");
        AcceptEntityInput(entity, "TurnOn");
        SetEntityMoveType(entity, MOVETYPE_FLY);
        
        GetEntPropVector(entity, Prop_Send, "m_angRotation", ang);
        ang[1] += 180.0;   
        
        new Handle:h=CreateDataPack();
        WritePackCell(h, entity);        
        WritePackFloat(h, Pos2[0]);
        WritePackFloat(h, Pos2[1]);
        WritePackFloat(h, Pos2[2]);        
        
        TeleportEntity(entity, Pos, ang, NULL_VECTOR);        
    
        CreateTimer(0.01 , Move , h);
    }    
}


public Action:Move ( Handle:timer, any:h )
{
   new Float:vel[3];
   
   ResetPack(h);
   decl Float:AlliesPos[3]
   decl Float:AxisPos[3];   
   new entity=ReadPackCell(h);
   Pos2[0]=ReadPackFloat(h);
   Pos2[1]=ReadPackFloat(h);
   Pos2[2]=ReadPackFloat(h);
   
   GetEntPropVector(entity, Prop_Data, "m_vecVelocity", vel);
   
   vel[0] = 250.0;      
   
   TeleportEntity( entity, Pos2, NULL_VECTOR , vel);
}
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<

Last edited by andi67; 02-23-2013 at 17:09.
andi67 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 13:34.


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