AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Offset for TeamScore? (https://forums.alliedmods.net/showthread.php?t=126147)

Leon M. 05-06-2010 03:03

Offset for TeamScore?
 
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

epic . 05-06-2010 03:39

Re: Offset for TeamScore?
 
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);
}


Leon M. 05-06-2010 04:42

Re: Offset for TeamScore?
 
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()



Arkshine 05-06-2010 05:08

Re: Offset for TeamScore?
 
Yes, there are 2 offsets, you can see this plugin as example : http://forums.alliedmods.net/showpos...&postcount=397

Leon M. 05-06-2010 08:06

Re: Offset for TeamScore?
 
Yeah, thanks Arkshine. Did I really read that Orpheu is now also compatible with windows?

Arkshine 05-06-2010 08:14

Re: Offset for TeamScore?
 
Yes, it is.

Leon M. 05-06-2010 12:40

Re: Offset for TeamScore?
 
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



Arkshine 05-06-2010 12:49

Re: Offset for TeamScore?
 
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. )

Leon M. 05-06-2010 13:19

Re: Offset for TeamScore?
 
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 :)


All times are GMT -4. The time now is 03:39.

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