Raised This Month: $ Target: $400
 0% 

Setting teamscore?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-25-2009 , 02:24   Re: Setting teamscore?
Reply With Quote #4

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
}
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>

Last edited by jim_yang; 07-25-2009 at 02:33.
jim_yang is offline
 



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 18:27.


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