AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   Change Points Awarded (https://forums.alliedmods.net/showthread.php?t=106419)

Ajaxx 10-14-2009 22:39

Change Points Awarded
 
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 10-18-2009 11:53

Re: Change Points Awarded
 
Doesn't anyone have an answer for this one way or the other?

Keeper 10-18-2009 18:07

Re: Change Points Awarded
 
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;
}


Ajaxx 10-18-2009 21:46

Re: Change Points Awarded
 
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.

Keeper 10-18-2009 22:15

Re: Change Points Awarded
 
There you would have to get the address for his score and on the bomb planting event remove 3 points.

Ajaxx 10-19-2009 00:23

Re: Change Points Awarded
 
Then I guess my question would be... How do you remove 3 points on the bomb planting event?

Keeper 10-19-2009 00:46

Re: Change Points Awarded
 
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?

Ajaxx 10-19-2009 01:12

Re: Change Points Awarded
 
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]

Keeper 10-19-2009 09:33

Re: Change Points Awarded
 
You need to have the following line defined before the #include "team.h"

Code:

#define GAME_DLL 1
#include "team.h"


Ajaxx 10-19-2009 12:58

Re: Change Points Awarded
 
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?


All times are GMT -4. The time now is 08:44.

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