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);
}
__________________