Raised This Month: $ Target: $400
 0% 

[TF2] Get ACTIVE Dominations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 08-01-2009 , 22:25   [TF2] Get ACTIVE Dominations
Reply With Quote #1

Im actually surprised I was able to figure this out w/o bugging people like mikejs or antithasys.

Someone asked that I have a domination difference auto-scramble check for my thing, so this is what I came up with. I didn't find any threads about it, so I figured i'd post it.

PHP Code:
stock TF2_GetPlayerDominations(client)
{
    new 
dominations;
    new 
offset FindSendPropInfo("CTFPlayerResource""m_iActiveDominations");
    new 
ent FindEntityByClassname(-1"tf_player_manager");
    if (
ent != -1)
        
dominations GetEntData(ent, (offset client*4), 4);    
    return 
dominations;
}

stock TF2_GetTeamDominations(team)
{
    new 
dominations;
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == team)
            
dominations += TF2_GetPlayerDominations(i);
    }
    return 
dominations;

__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 08-02-2009 , 00:16   Re: [TF2] Get Dominations
Reply With Quote #2

You can also just do...

TF2_GetPlayerResourceData(client, TFResource_Dominations);
__________________
CrimsonGT is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 08-02-2009 , 01:16   Re: [TF2] Get Dominations
Reply With Quote #3

Quote:
Originally Posted by CrimsonGT View Post
You can also just do...

TF2_GetPlayerResourceData(client, TFResource_Dominations);
sigh i always overlook the easy stuff.... assuming thats their active domination #, and not the # they've accumulated for the duration of the map

edit, i took a lookie at the tf2_stocks file, and I can tell you now, that's Not what I want. it looks at m_iDomiantions, which is just the # of dominations that the client has accumulated throughout the map. It does not go down when someone gets revenge on them. What I want is the # of active dominations (people that have the dominated symbol next to their name on the scoreboard for the client)

I should have looked there first though, thanks for showing me.
__________________
My Pluggies If you like, consider to me.

Last edited by BrutalGoerge; 08-02-2009 at 03:17.
BrutalGoerge is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 08-02-2009 , 14:21   Re: [TF2] Get ACTIVE Dominations
Reply With Quote #4

PHP Code:
stock GetDominationCount(client)
{
    new 
countoffset FindSendPropInfo("CTFPlayer""m_bPlayerDominated");
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetEntData(clientoffset+i) == 1)
        {
            
count++;
        }
    }

    return 
count;

Something like that should work.
bl4nk is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 08-02-2009 , 14:35   Re: [TF2] Get ACTIVE Dominations
Reply With Quote #5

Quote:
Originally Posted by bl4nk View Post
PHP Code:
stock GetDominationCount(client)
{
    new 
countoffset FindSendPropInfo("CTFPlayer""m_bPlayerDominated");
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetEntData(clientoffset+i) == 1)
        {
            
count++;
        }
    }

    return 
count;

Something like that should work.
that's what i had originally, then i found the way i posted, both work... im not sure what way is better
__________________
My Pluggies If you like, consider to me.

Last edited by BrutalGoerge; 08-02-2009 at 14:42.
BrutalGoerge is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 08-02-2009 , 14:44   Re: [TF2] Get ACTIVE Dominations
Reply With Quote #6

Ah I see what you mean. Yeah, either way should be fine, I think TF2_GetPlayerDominations() is just cleaner though. Increases readability a bit which helps in the long run
__________________
CrimsonGT is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 08-03-2009 , 02:27   Re: [TF2] Get ACTIVE Dominations
Reply With Quote #7

Ah, I was tired last night and thought you were asking for help. Oh well, at least I presented another valid way to do it.
bl4nk 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 18:16.


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