AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Comparing ways of getting team (https://forums.alliedmods.net/showthread.php?t=216863)

President 05-26-2013 13:21

Comparing ways of getting team
 
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.

ConnorMcLeod 05-26-2013 17:25

Re: Comparing ways of getting team
 
1 and 2 not used in cs
3 and 4 are the same.

isotonic 12-16-2013 18:43

Re: Comparing ways of getting team
 
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...

ConnorMcLeod 12-16-2013 19:05

Re: Comparing ways of getting team
 
Then use cs_get_user_team...

Anyway, use get_user_team

isotonic 12-16-2013 19:53

Re: Comparing ways of getting team
 
iTeam = get_user_team(id) returns wrong result for dead players who has changed team after death in AMXX 1.8.2 devs ;)

fysiks 12-17-2013 02:14

Re: Comparing ways of getting team
 
Quote:

Originally Posted by isotonic (Post 2072942)
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


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

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