Raised This Month: $ Target: $400
 0% 

Player standing on air


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JPiolho
Member
Join Date: Dec 2004
Location: Portugal
Old 02-24-2006 , 06:12   Player standing on air
Reply With Quote #1

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
__________________
JPiolho is offline
Send a message via MSN to JPiolho
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 02-24-2006 , 06:19  
Reply With Quote #2

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

The minimum is 0.1

Code:
set_task(0.1,"Task_UpdateEnt")
__________________
Um, hi.
Ramono is offline
JPiolho
Member
Join Date: Dec 2004
Location: Portugal
Old 02-24-2006 , 06:21  
Reply With Quote #3

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?
__________________
JPiolho is offline
Send a message via MSN to JPiolho
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 02-24-2006 , 06:24  
Reply With Quote #4

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)
__________________
Um, hi.
Ramono is offline
JPiolho
Member
Join Date: Dec 2004
Location: Portugal
Old 02-24-2006 , 06:28  
Reply With Quote #5

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.
__________________
JPiolho is offline
Send a message via MSN to JPiolho
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 02-24-2006 , 06:49  
Reply With Quote #6

I'm sorry i can't help you further, i still need to learn too.
Entity's are hard.
__________________
Um, hi.
Ramono is offline
JPiolho
Member
Join Date: Dec 2004
Location: Portugal
Old 02-24-2006 , 06:55  
Reply With Quote #7

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
__________________
JPiolho is offline
Send a message via MSN to JPiolho
Reply



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 20:16.


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