AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player standing on air (https://forums.alliedmods.net/showthread.php?t=24476)

JPiolho 02-24-2006 06:12

Player standing on air
 
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) }

Mod: Sven co-op

Ramono 02-24-2006 06:19

Code:
set_task(0.05,"Task_UpdateEnt",0,"",0,"",0)

The minimum is 0.1

Code:
set_task(0.1,"Task_UpdateEnt")

JPiolho 02-24-2006 06:21

0.05 works too, it changes the origin of player. But the problem its how to set the player on air, without falling or moving?

Ramono 02-24-2006 06:24

Quote:

Originally Posted by JPiolho
0.05 works too, it changes the origin of player. But the problem its how to set the player on air, without falling or moving?

http://www.amxmodx.org/funcwiki.php?...task&go=search

The site says: * Float:time - Interval of timer in second. (minimum 0.1 seconds)

Try set_user_maxspeed(id,0.0)
and set_user_gravity(id,0.0)

JPiolho 02-24-2006 06:28

I've tryed to put gravity 0.0 and it stays falling... about max_speed I dont realy need because the player cant move long, also it says to the same place.

Ramono 02-24-2006 06:49

I'm sorry i can't help you further, i still need to learn too.
Entity's are hard. :oops:

JPiolho 02-24-2006 06:55

Well... I was looking on Vectors keys, and I've found: EV_VEC_velocity

Code:
Velocity[0] = 0.0     Velocity[1] = 0.0     Velocity[2] = 0.0         entity_set_vector(ent2_x, EV_VEC_velocity,Velocity)
It works perfect now :D


All times are GMT -4. The time now is 20:16.

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