Raised This Month: $32 Target: $400
 8% 

players inside car or train


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 09:38   players inside car or train
Reply With Quote #1

I need to detect all the players inside a "func_vehicle" or "func_tracktrain" espessialy the driver.
I tried to do that using pev_size and find_sphere_class("player") but the result was a random-looklike.
how to do this in accuarate way?
__________________
man_s_our is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-21-2018 , 10:15   Re: players inside car or train
Reply With Quote #2

try getting its owner EV_ENT_owner
__________________
retired chump
DjSoftero is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 11:23   Re: players inside car or train
Reply With Quote #3

this work in pev() or which comand?
__________________
man_s_our is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 11:27   Re: players inside car or train
Reply With Quote #4

what will it return if it has no driver?
__________________
man_s_our is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-21-2018 , 14:09   Re: players inside car or train
Reply With Quote #5

I'm not sure what it returns in case of the vehicle being unmounted/empty. I gave it as a suggestion for you to test. Try looping through all the func_veicle entities and checking that EV_ENT_owner pointer, or whatever it is called by printing values in different instances and comparing them. Also there is EV_ENT_pContainingEntity which sounds promising.

Code:
Edicts, use with entity_[get|set]_edict()# enum {     EV_ENT_chain = 0,     EV_ENT_dmg_inflictor,     EV_ENT_enemy,     EV_ENT_aiment,     EV_ENT_owner,     EV_ENT_groundentity,     EV_ENT_pContainingEntity,     EV_ENT_euser1,     EV_ENT_euser2,     EV_ENT_euser3,     EV_ENT_euser4, };
https://www.amxmodx.org/api/engine_const
__________________
retired chump

Last edited by DjSoftero; 03-21-2018 at 14:11.
DjSoftero is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 14:36   Re: players inside car or train
Reply With Quote #6

thats already exist. check Entity Lab (Engine based) [Final].
the best choise until now it's getting the size but when I tried it the result was semi-randiom.
I'll check for getting the size using those functions instead of pev.
__________________
man_s_our is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-21-2018 , 14:39   Re: players inside car or train
Reply With Quote #7

Looks like func_vehicle keeps track of its driver with m_pDriver member (pdata). Should be retrievable with get_pdata_cbase in 1.8.2 or get_ent_data_entity in 1.8.3-dev.
__________________

Last edited by klippy; 03-21-2018 at 14:41.
klippy is offline
Old 03-21-2018, 15:03
man_s_our
This message has been deleted by man_s_our. Reason: founded the link
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 15:42   Re: players inside car or train
Reply With Quote #8

which link I should download that version from?
I'm using windows.
link
__________________
man_s_our is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-21-2018 , 17:25   Re: players inside car or train
Reply With Quote #9

You don't have to download anything, 99% chance is that you are running 1.8.2 or higher on your server. If you use the 1.8.2 way it will work for 1.8.3-dev too. I just provided a way to get vehicle's driver.
__________________

Last edited by klippy; 03-21-2018 at 17:25.
klippy is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-21-2018 , 18:04   Re: players inside car or train
Reply With Quote #10

Quote:
Originally Posted by KliPPy View Post
You don't have to download anything, 99% chance is that you are running 1.8.2 or higher on your server. If you use the 1.8.2 way it will work for 1.8.3-dev too. I just provided a way to get vehicle's driver.
the compiler didn't recognize the 2nd command even that I included fakemeta, while reconized the 1st.
__________________

Last edited by man_s_our; 03-21-2018 at 18:11.
man_s_our is offline
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 12:23.


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