I'm working on a plugin to drive cars, and I want to make the player to see the car outside, so I teleport him to Car Z + 256, but the problem it's the gravity, is always pushing down him. Every 0.05 it updates the origin (To follow the car). I've already tryed to put gravity 0.0, noclip, fly... Nothing work... Take a look at code and help me please:
Code:
#include <amxmodx>
#include <engine>
#include <fun>
new ent1_x
new ent2_x
new Drive
public plugin_init()
{
register_plugin("Driving Car","1.0","JPiolho")
register_concmd("drive","function_drivein")
register_concmd("+drive_forward","function_driveforward")
register_concmd("-drive_forward","function_driveforward_s")
register_touch("func_pushable","monster_zombie","CheckCarKill")
register_touch("func_pushable","player","CheckCarKill")
}
public CheckCarKill(Toucher, Touched)
{
if(Toucher == ent1_x)
{
fakedamage(Touched,"monster_zombie",900.0,1)
}
}
public function_driveforward(id)
{
new Float:Velocity[3]
velocity_by_aim(ent2_x, 500, Velocity)
entity_set_vector(ent1_x, EV_VEC_velocity, Velocity)
Drive = 1
set_task(0.5,"Task_DriveForward",0,"",0,"",0)
}
public function_driveforward_s(id)
{
Drive = 0
}
public Task_DriveForward(id)
{
new Float:Velocity[3]
velocity_by_aim(ent2_x, 1000, Velocity)
entity_set_vector(ent1_x, EV_VEC_velocity, Velocity)
if(Drive == 1)
{
set_task(0.5,"Task_DriveForward",0,"",0,"",0)
}
}
public function_drivein(id)
{
new arg1[10]
new Float:ent1_x_o[3]
read_argv(1,arg1,9)
if(is_valid_ent(str_to_num(arg1)))
{
ent1_x = str_to_num(arg1)
ent2_x = id
entity_set_int(id, EV_INT_movetype, 5);
entity_get_vector(ent1_x, EV_VEC_origin, ent1_x_o);
ent1_x_o[2] = ent1_x_o[2] + 256
entity_set_vector(ent2_x, EV_VEC_origin, ent1_x_o);
set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransColor, 0)
set_task(0.05,"Task_UpdateEnt",0,"",0,"",0)
}
}
public Task_UpdateEnt()
{
new Float:angle_ent1[3]
new Float:origin_ent1[3]
entity_get_vector(ent2_x, EV_VEC_angles, angle_ent1);
entity_get_vector(ent1_x, EV_VEC_origin, origin_ent1);
origin_ent1[2] = origin_ent1[2] + 256.0
angle_ent1[0] = 0.0
angle_ent1[1] = angle_ent1[1] - 180.0
angle_ent1[2] = 0.0
entity_set_vector(ent2_x, EV_VEC_origin, origin_ent1);
entity_set_int(ent2_x, EV_INT_movetype, 5);
entity_set_vector(ent1_x, EV_VEC_angles, angle_ent1);
set_task(0.05,"Task_UpdateEnt",0,"",0,"",0)
}