Raised This Month: $32 Target: $400
 8% 

Changing Players Score in TF2


Post New Thread Reply   
 
Thread Tools Display Modes
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-21-2008 , 16:22   Re: Changing Players Score in TF2
Reply With Quote #21

The only way to change a player's score in TF2 is to use an extension, a MM:S plugin, or server addon.
bl4nk is offline
msleeper
Veteran Member
Join Date: May 2008
Location: Atlanta, Jawjuh
Old 07-21-2008 , 16:33   Re: Changing Players Score in TF2
Reply With Quote #22

Well damn. Any idea when the extension you, Nephyrin and pRED are working on will be available? ;)
__________________
msleeper is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-21-2008 , 16:38   Re: Changing Players Score in TF2
Reply With Quote #23

Nope. I'm going to be releasing a plugin for it when I get it done though.
bl4nk is offline
msleeper
Veteran Member
Join Date: May 2008
Location: Atlanta, Jawjuh
Old 07-25-2008 , 15:48   Re: Changing Players Score in TF2
Reply With Quote #24

Quote:
Originally Posted by berni View Post
Well like msleeper was explaining it, it doesn't seem to get updated every frame. And in hl2dm I did it the way I described above
Could you post or PM your code for HL2DM that you were able to do this? I can't seem to get things straight, edicts still elude me a bit. Thanks.
__________________
msleeper is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 07-25-2008 , 19:14   Re: Changing Players Score in TF2
Reply With Quote #25

Of course I can, I'm not sure if this is useful for TF2, but it is for hl2dm

Code:
public OnPluginStart() {
    RegAdminCmd("sm_setscore", Command_SetScore, ADMFLAG_ROOT);
}

public bool:_SetTeamScore(client, index, value) {
    
    new team = MAXPLAYERS + 1;
    
    team = FindEntityByClassname(-1, "team_manager");
    
    while (team != -1) {
        
        if (GetEntProp(team, Prop_Send, "m_iTeamNum", 1) == index) {
            
            SetEntProp(team, Prop_Send, "m_iScore", value, 4);
            ChangeEdictState(team, GetEntSendPropOffs(team, "m_iScore"));
            
            PrintToServer("[SM] Team %d gefunden", index);
            
            return true;
        }
        
        team = FindEntityByClassname(team, "team_manager");
    }
    
    return false;
}

public Action:Command_SetTeamScore(client, args) {
    
    if (args != 2) {
        ReplyToCommand(client, "\x04[SM] \x01Usage: sm_setteamscore <team> <value>");
        
        return Plugin_Handled;
    }
    
    decl String:str_team[8], String:arg2[8];
    GetCmdArg(1, str_team, sizeof(str_team));
    GetCmdArg(2, arg2, sizeof(arg2));
    
    new team = StringToInt(str_team);
    new teamscore = StringToInt(arg2);
    
    _SetTeamScore(client, team, teamscore);

    
    return Plugin_Handled;
}

Last edited by berni; 07-25-2008 at 19:17.
berni 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 22:35.


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