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

[TF2] Set Dominations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
J-Factor
Junior Member
Join Date: Jul 2009
Old 07-01-2009 , 05:07   [TF2] Set Dominations
Reply With Quote #1

Simple snippet that allows you to set Dominations. Doesn't show the Domination message ("Player 1 is DOMINATING Player 2") but Revenge works.

PHP Code:
new offsDominatingMe = -1;
new 
offsDominated = -1;

public 
OnPluginStart()
{
    
offsDominatingMe FindSendPropInfo("CTFPlayer""m_bPlayerDominatingMe");
    
offsDominated FindSendPropInfo("CTFPlayer""m_bPlayerDominated");
}

stock TF2_SetPlayerDominated(dominatorvictimbool:value=true)
{
    
SetEntData(dominatoroffsDominated victimvalue1true);
    
SetEntData(victimoffsDominatingMe dominatorvalue1true);

Example use:
PHP Code:
SetAllDominating(client)
{
    for (new 
1<= MaxClientsi++) {
        if (
IsClientConnected(i) && IsClientInGame(i)) {
            
TF2_SetPlayerDominated(iclienttrue);
        }
    }

Sets all players as dominating client. Even 'client' themselves! (suicide causes a revenge).

Last edited by J-Factor; 07-01-2009 at 05:09. Reason: Had '< MaxClients' instead of '<= MaxClients'
J-Factor is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-01-2009 , 11:47   Re: [TF2] Set Dominations
Reply With Quote #2

Why not just use SetEntProp instead of having to worry about finding the offset and such?

[edit]

Nevermind, didn't see that you had to add the victim to the offset. Shouldn't it be "offsDominated + victim*4" and such?
bl4nk is offline
J-Factor
Junior Member
Join Date: Jul 2009
Old 07-01-2009 , 12:31   Re: [TF2] Set Dominations
Reply With Quote #3

Quote:
Shouldn't it be "offsDominated + victim*4" and such?
Fairly new to SM and offsets but it seems domination flags are only one byte. Compare:

Code:
    Sub-Class Table (4 Deep): m_iAmmo
    -Member: 000 (offset 0) (type integer) (bits 10)
    -Member: 001 (offset 4) (type integer) (bits 10)
    -Member: 002 (offset 8) (type integer) (bits 10)
    -Member: 003 (offset 12) (type integer) (bits 10)
    ...
with

Code:
    Sub-Class Table (4 Deep): m_bPlayerDominated
    -Member: 000 (offset 0) (type integer) (bits 1)
    -Member: 001 (offset 1) (type integer) (bits 1)
    -Member: 002 (offset 2) (type integer) (bits 1)
    -Member: 003 (offset 3) (type integer) (bits 1)
    -Member: 004 (offset 4) (type integer) (bits 1)
    ...
Is it right that the (offset x) shows how many bytes each member uses (for data + padding)? While the (bits x) shows how many bits of those bytes are actually used for data?

Last edited by J-Factor; 07-01-2009 at 13:34. Reason: Grammar
J-Factor 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 11:13.


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