Raised This Month: $ Target: $400
 0% 

Comparing ways of getting team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
President
Member
Join Date: May 2013
Old 05-26-2013 , 13:21   Comparing ways of getting team
Reply With Quote #1

Hi developers,
I would like to know which way of getting team is the fastest.
Can someone show me benchmark of
PHP Code:
entity_get_int(idEV_INT_team);
pev(idpev_team);
get_pdata_int(id114);
cs_get_user_team(id); 
I would also like to know which way is the most reliable.

Last edited by President; 05-26-2013 at 13:23.
President is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-26-2013 , 17:25   Re: Comparing ways of getting team
Reply With Quote #2

1 and 2 not used in cs
3 and 4 are the same.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 12-16-2013 , 18:43   Re: Comparing ways of getting team
Reply With Quote #3

Wrote for newbies.

It is recommended using macros instead of writing numbers right in the code.

PHP Code:
// offsets
#define m_iTeam 114

public plugin_init() {
    
//...
}

some_function(id) {
    
//...
    
iTeam get_pdata_int(idm_iTeam)
    
//...


I'm not sure is it required to check pev_valid(id) == 2 before using get_pdata_int in that particular case...
__________________
isotonic is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-16-2013 , 19:05   Re: Comparing ways of getting team
Reply With Quote #4

Then use cs_get_user_team...

Anyway, use get_user_team
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 12-16-2013 , 19:53   Re: Comparing ways of getting team
Reply With Quote #5

iTeam = get_user_team(id) returns wrong result for dead players who has changed team after death in AMXX 1.8.2 devs ;)
__________________

Last edited by isotonic; 12-16-2013 at 19:53.
isotonic is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-17-2013 , 02:14   Re: Comparing ways of getting team
Reply With Quote #6

Quote:
Originally Posted by isotonic View Post
iTeam = get_user_team(id) returns wrong result for dead players who has changed team after death in AMXX 1.8.2 devs ;)
You mean this: https://bugs.alliedmods.net/show_bug.cgi?id=4656
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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


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