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

Change Points Awarded


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-14-2009 , 22:39   Change Points Awarded
Reply With Quote #1

How do I change the points awarded via a CS:S plugin? I want to give the entire team 1 point for a bomb detonation (including the player that planted the bomb) and the entire losing team -1 point. How would I do this?
Ajaxx is offline
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-18-2009 , 11:53   Re: Change Points Awarded
Reply With Quote #2

Doesn't anyone have an answer for this one way or the other?
Ajaxx is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-18-2009 , 18:07   Re: Change Points Awarded
Reply With Quote #3

You have to find the CTeam instances for the teams and then you would use team->SetScore(team->GetScore()+1);

Here's what I've used to get the team:
Code:
CTeam * CPlugin::GetATeam( int teamNum ) {
    for(int i = 0; i < engine->GetEntityCount(); i++) {
        edict_t *pEntity = engine->PEntityOfEntIndex(i);
        if( pEntity && FStrEq(pEntity->GetClassName(), "team_manager") ) {
            CTeam *team = (CTeam*)pEntity->GetUnknown()->GetBaseEntity();
            if ( team && team->GetTeamNumber() == teamNum )
                return team;
        }
    }
    return NULL;
}
Keeper is offline
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-18-2009 , 21:46   Re: Change Points Awarded
Reply With Quote #4

Excellent, thanks Keeper! How would I prevent the bomb planter from getting the 3 extra points? I want the whole team to receive the same 1 point.
Ajaxx is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-18-2009 , 22:15   Re: Change Points Awarded
Reply With Quote #5

There you would have to get the address for his score and on the bomb planting event remove 3 points.
Keeper is offline
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-19-2009 , 00:23   Re: Change Points Awarded
Reply With Quote #6

Then I guess my question would be... How do you remove 3 points on the bomb planting event?
Ajaxx is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-19-2009 , 00:46   Re: Change Points Awarded
Reply With Quote #7

I'd look here for help on that...http://forums.alliedmods.net/showpos...71&postcount=4

Dunno what you'd want to search for tho, maybe m_iScore or m_iFrags?

Last edited by Keeper; 10-19-2009 at 00:49.
Keeper is offline
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-19-2009 , 01:12   Re: Change Points Awarded
Reply With Quote #8

I have a rookie question about your code example. How do I reference the CTeam class? When I add
#include "team.h"
to my plugin solution I get a lot of compile errors.

[IMG]http://img190.**************/img190/4937/errorlist.jpg[/IMG]
Ajaxx is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-19-2009 , 09:33   Re: Change Points Awarded
Reply With Quote #9

You need to have the following line defined before the #include "team.h"

Code:
#define GAME_DLL 1
#include "team.h"
Keeper is offline
Ajaxx
Senior Member
Join Date: Oct 2009
Old 10-19-2009 , 12:58   Re: Change Points Awarded
Reply With Quote #10

I'm still getting the same errors. It doesn’t have anything to do with the fact that I’m trying to build a plugin instead of a MOD does it?
Ajaxx 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 06:32.


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