Raised This Month: $51 Target: $400
 12% 

Distance between player1 and victim player2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-17-2015 , 12:32   Distance between player1 and victim player2
Reply With Quote #1

Since I am returning distance between "player" and a bot,
I need to specify the proper entity class name of the bot.

So what should I use ?
(I couldn't find anything related in the internet)

Last edited by Al3; 09-17-2015 at 14:17.
Al3 is offline
Send a message via Skype™ to Al3
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-17-2015 , 12:47   Re: Bot has entity class?
Reply With Quote #2

bot has the classname "player". You can check is_user_bot to know if a user is a bot or not.
__________________
HamletEagle is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-17-2015 , 13:40   Re: Bot has entity class?
Reply With Quote #3

Hmm. Then something else is wrong in the code.
I use this:

PHP Code:
    new CTent    fm_find_ent_by_owner(-1"player"CTs[i]); // get_players CT loop index
    
new Tent    fm_find_ent_by_owner(-1"player"id);
    new 
dist    get_range(CTentTent); 
do determine range between T and CT.
It looks like get_range enters infinite loop as the function doesn't continue by the call.
And I thought it's because it had no "players" to loop through.

Last edited by Al3; 09-17-2015 at 13:41.
Al3 is offline
Send a message via Skype™ to Al3
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-17-2015 , 16:04   Re: Distance between player1 and victim player2
Reply With Quote #4

PHP Code:
new CTent    fm_find_ent_by_owner(-1"player"CTs[i]); // get_players CT loop index
new Tent    fm_find_ent_by_owner(-1"player"id); 
This does not really make sense, pass directly the player index to get_range. find_ent_by_owner finds an entity when it's owner is know, not needed here. Also don't use fakemeta_util, it's ok for learning, but it's slower than original engine/fakemeta/fun/cstrike functions(look for example at give_item and fm_give_item).
__________________

Last edited by HamletEagle; 09-17-2015 at 16:05.
HamletEagle is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-17-2015 , 18:02   Re: Distance between player1 and victim player2
Reply With Quote #5

Actually it was entity_range sorry.
get_range doesn't work on counter-strike.
It gives me bad load on inclusion at least.

And thanks. Didn't know entity and client index is one and the same.

Last edited by Al3; 09-17-2015 at 18:15.
Al3 is offline
Send a message via Skype™ to Al3
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-17-2015 , 18:41   Re: Distance between player1 and victim player2
Reply With Quote #6

If you're trying to find the distance between 2 players just use get_distance or get_distance_f.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd 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 06:31.


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