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

Offset for TeamScore?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-06-2010 , 03:03   Offset for TeamScore?
Reply With Quote #1

Hi,

I would like to set my own team scores but I have an issue. My scores are reset to the original values when a player respawned. I want not to hook the TeamScore Event. Is there a OFFSET to save the score internal?

Greetz
Leon
Leon M. is offline
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 05-06-2010 , 03:39   Re: Offset for TeamScore?
Reply With Quote #2

I don`t konw if I misread you, this code can save the teamscore into g_TeamScore[ CsTeams ]
Code:
new g_TeamScore[ CsTeams ]
public plugin_init()
{
    register_event("TeamScore", "fw_EvTeamScore", "a")
}
public fw_EvTeamScore()
{
    new szTeam[2];
    read_data(1, szTeam, 1);
    g_TeamScore[ ( szTeam[0] == 'T' ) ? CS_TEAM_T : CS_TEAM_CT ] = read_data(2);
}
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
Old 05-06-2010, 03:40
epic .
This message has been deleted by epic .. Reason: bad net ,cause double post
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-06-2010 , 04:42   Re: Offset for TeamScore?
Reply With Quote #3

I want not to catch the scores, I want to use my own scores. If I set my scores and a player respawns he got the original scores from cs. Ofcourse I could hook the TeamScore with register_message, but I search for an offset. Anywhere must be saved the scores.

PHP Code:
public func_team_scored(iTeamid){
    new 
iDeaths cs_get_user_deaths(id), iFrags pev(idpev_frags) + 5
    set_pev
(idpev_fragsiFrags)
    
g_iScore[iTeam]++

    
message_begin(MSG_BROADCASTgMsgScoreInfo)
    
write_byte(id)
    
write_short(iFrags)
    
write_short(iDeaths)
    
write_short(0)
    
write_short(iTeam)
    
message_end()

    
message_begin(MSG_BROADCASTgMsgTeamScore)
    
write_string(iTeam == TEAM_T "TERRORIST" "CT")
    
write_short(g_iScore[iTeam])
    
message_end()

Leon M. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-06-2010 , 05:08   Re: Offset for TeamScore?
Reply With Quote #4

Yes, there are 2 offsets, you can see this plugin as example : http://forums.alliedmods.net/showpos...&postcount=397
__________________
Arkshine is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-06-2010 , 08:06   Re: Offset for TeamScore?
Reply With Quote #5

Yeah, thanks Arkshine. Did I really read that Orpheu is now also compatible with windows?
Leon M. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-06-2010 , 08:14   Re: Offset for TeamScore?
Reply With Quote #6

Yes, it is.
__________________
Arkshine is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-06-2010 , 12:40   Re: Offset for TeamScore?
Reply With Quote #7

This is fantastic

Still a last question: I'm using Ham_TakeDamage to catch a damage and execute some stuff. How I get the hitplace? Is the hitplace already set in the offset?

PHP Code:
new const m_LastHitGroup 75

public ham_takedamage(iVictimiInflictoriAttackerFloat:fDamageiDmgBits){

    
//A grenade or c4 explode
    
if (iInflictor != iAttacker) return HAM_IGNORED

    
new szClassA[33]
    
pev(iAttackerpev_classnameszClassA32)

    if (
equal(szClassA"player")){
        new 
iWeapID get_user_weapon(iAttacker)

        if (
iHitPlace == HIT_HEAD){
            ....
        }
    }

    return 
HAM_IGNORED

Leon M. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-06-2010 , 12:49   Re: Offset for TeamScore?
Reply With Quote #8

Use the player's offset m_LastHitGroup ( 75 ). It would be nice if you start to search before posting, such thing has already been asked numerous times. ( About your code, to check if it's a player, no need to check the classname, just check if the index is between 1 and maxclient. )
__________________
Arkshine is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-06-2010 , 13:19   Re: Offset for TeamScore?
Reply With Quote #9

I have searched before I asked here. Exactly for Ham_TakeDamage and Hitplace and I got two threads. I didn't find the answer in these Topics, sorry

But thanks for your answer and the tip
Leon M. 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 07:07.


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