AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting teamscore? (https://forums.alliedmods.net/showthread.php?t=98307)

Hayer 07-24-2009 10:15

Setting teamscore?
 
Hi!

How does I increse the Counter-Terrorists score by 10?

devil001 07-24-2009 13:16

Re: Setting teamscore?
 
http://forums.alliedmods.net/showthread.php?t=27590

or try this:


Code:

/**
    * Description:        Typically adds points to everybody on the entity's team.
    * Forward params:    function(this, points, bool:cangonegative);
    * Return type:        None.
    * Execute params:    ExecuteHam(Ham_AddPointsToTeam, this, points, bool:cangonegative);
    */
    Ham_AddPointsToTeam,



Arkshine 07-24-2009 13:24

Re: Setting teamscore?
 
Ham_AddPointsToTeam add points for all players of a team.

There is the module cshack but I don't know if it works well. AFAIK there is are no amxx plugin which alter the team score.

"ScoreInfo" event updates the team score only on the score board and not internally.

jim_yang 07-25-2009 02:24

Re: Setting teamscore?
 
teamscore stores in this class
CGameRules, I don't know the member variable's name. Its offset (word based) is 120(ct) & 122(t)
This class doesn't have an entity to linked with. It just declare as a global variable.
extern DLL_GLOBAL CGameRules *g_pGameRules
in win32 this offset has changed to 0x1622F4
Code:

#include <amxmodx>
#include <memhack>
 
#define PLUGIN    "Test"
#define AUTHOR    "Jim"
#define VERSION  "1.0"
 
#define OFFSET_g_pGameRules 0x1622F4
#define OFFSET_m_TScores    122
#define OFFSET_m_CTScores  120
#define TEAM_T    1
#define TEAM_CT  2
 
new g_pGameRules
new gmsgTeamScore
 
add_team_score(teamid, score)
{
    new offset
    switch(teamid)
    {
        case TEAM_T: offset = OFFSET_m_TScores
        case TEAM_CT: offset = OFFSET_m_CTScores
        default: return
    }
    new oldscore = memhack_get_short(g_pGameRules + offset, MEM_NULLBASE)
    new newscore = oldscore + score
    memhack_set_short(g_pGameRules + offset, MEM_NULLBASE, newscore)
 
    message_begin(MSG_ALL, gmsgTeamScore)
    write_string(teamid == TEAM_T ? "TERRORIST" : "CT")
    write_short(newscore)
    message_end()
}
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("test", "test")
    g_pGameRules = memhack_get_pointer(OFFSET_g_pGameRules)
    gmsgTeamScore = get_user_msgid("TeamScore")
}
 
public test(id)
{
    add_team_score(TEAM_CT, 10)
    return PLUGIN_HANDLED
}


Owyn 04-07-2010 16:31

Re: Setting teamscore?
 
Quote:

Ham_AddPointsToTeam add points for all players of a team.
just tested it, ham adds nothing :crab:
just no effect no matter how much i do ham cmd

PHP Code:

public plugin_init()

    
register_clcmd"score1"            "score1"        , -);
}
public 
score1(id)
{
    
ExecuteHamB(Ham_AddPointsToTeamid1false);
    
log_amx("PLUS"); //



Arkshine 04-07-2010 17:59

Re: Setting teamscore?
 
Weird. Ham_AddPoints works though.

Owyn 04-10-2010 15:09

Re: Setting teamscore?
 
hmm.. wtf it just adds frags, nothing releted to teamscore =\

Arkshine 04-10-2010 15:13

Re: Setting teamscore?
 
Of course, I thought you had already understood that... after reading #3 above.

For team score, you have to use Orpheu. Basically g_pGamerules and the offsets 120/122.


All times are GMT -4. The time now is 18:27.

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