Raised This Month: $ Target: $400
 0% 

[L4D2] Assist Points


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WolfGang
BANNED
Join Date: Oct 2010
Old 03-01-2013 , 18:12   [L4D2] Assist Points
Reply With Quote #1

PHP Code:
public Action:Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ATTACKER
    CLIENT
    
new victim GetClientOfUserId(GetEventInt(event"userid"));
    if(
attacker && client && !IsFakeClient(attacker) && IsAllowedGameMode() && GetConVarInt(Enable) == 1)
    {
        
decl String:vName[MAX_NAME_LENGTH];
        
GetClientName(victimvNamesizeof(vName));
        new 
bool:notify commonKillDisplay[attacker] == 1;
        if(
GetClientTeam(attacker) == 2)
        {
            new 
sipoints GetConVarInt(SSIKill);
            if(
sipoints || GetClientTeam(client) == || GetEntProp(clientProp_Send"m_zombieClass") == 8) return;
            new 
bool:headshot GetEventBool(event"headshot");
            if(
headshotheadshotcount[attacker]++;
            new 
headsneeded GetConVarInt(SNumberHead);
            new 
headpoints GetConVarInt(SValueHeadSpree);
            if(
headshotcount[attacker] == headsneeded && headpoints 0)
            {
                
points[attacker] += headpoints;
                
headshotcount[attacker] -= headsneeded;
                if(
notifyPrintToChat(attacker"%s %T"MSGTAG"Head Hunter"headpoints);
            }
            
points[attacker] += sipoints;
            if(
notifyCPrintToChat(attacker"%s %T"MSGTAG"Killed SI"sipointsvName);
        }
        else if(
GetClientTeam(attacker) == 3)
        {
            new 
killpoints GetConVarInt(IKill);
            if(
killpoints || GetClientTeam(client) == 3) return;
            
points[attacker] += killpoints;
            if(
notifyPrintToChat(attacker"%s %T"MSGTAG"Killed Survivor"killpointsvName);
        }    
    }    

Anyone have a clue on how to give the other players who did additional damage to the infected?

Last edited by WolfGang; 03-01-2013 at 18:15.
WolfGang is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 03-01-2013 , 21:23   Re: [L4D2] Assist Points
Reply With Quote #2

this is super easy. just view the functions.sp file in skyrpg 2 to see how to do it.
Skyy is offline
WolfGang
BANNED
Join Date: Oct 2010
Old 03-02-2013 , 17:18   Re: [L4D2] Assist Points
Reply With Quote #3

Sorry for my understanding, but what I meant was when using McFlurry Point System; there's a message that shows up when an infected is killed by a player (i.e Killed Special Infected +1 points), and I want other players who also did damage as well will only see a message (i.e Assist: +2 points), not both.

EDIT: The example what I'm trying to get out of is from the sever in steam is "gcftw"

Last edited by WolfGang; 03-02-2013 at 17:19.
WolfGang is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 03-02-2013 , 22:52   Re: [L4D2] Assist Points
Reply With Quote #4

The gcftw server uses a heavily modified version of mcflurry's buy plugin, to my knowledge.
If you want to record assist points, you have to simply track all of the players who dealt damage to the special infected. the easiest way is on the player_hurt event to do something like AssistAgainst[attacker][victim] = true;
when the victim dies, just loop through and if (AssistAgainst[i][victim]) { AwardAssistPoints(i); AssistAgainst[i][victim] = false; } You can use a boolean if you don't care about the actual damage and simply want to award points regardless of the damage any assisting players dealt.

the awardassist would look something like

stock AwardAssistPoints(client) { Points[client] += 2; PrintToChat(client, "Assist: +2 points"); }
Skyy is offline
WolfGang
BANNED
Join Date: Oct 2010
Old 03-03-2013 , 14:15   Re: [L4D2] Assist Points
Reply With Quote #5

Here's my example of understanding what you're telling me:

PHP Code:
/* Original Code */
public Action:Event_Hurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CLIENT
    ATTACKER
    
if(attacker && client && !IsFakeClient(attacker) && GetClientTeam(attacker) == && GetClientTeam(client) == && IsAllowedGameMode() && GetConVarInt(Enable) == && GetConVarInt(IHurt) > 0)
    {
        
hurtcount[attacker]++;
        new 
type GetEventInt(event"type");
        
//PrintToChat(attacker, "Damagetype: %d", type);
        
if( (type == 263168 || type == 265216) && hurtcount[attacker] >= )
        {
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Spit Damage"LANG_SERVERGetConVarInt(IHurt));
            
points[attacker] += GetConVarInt(IHurt);
            
hurtcount[attacker] -= 8;
        } 
        else if(
type != 263168 && type != 265216 && hurtcount[attacker] >= 3)
        {
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Damage"LANG_SERVERGetConVarInt(IHurt));
            
points[attacker] += GetConVarInt(IHurt);
            
hurtcount[attacker] -= 3;
        } 
    }    

PHP Code:
/* Modified Code */ 
public Action:Event_Hurt(Handle:event, const String:name[], bool:dontBroadcast

    
CLIENT 
    ATTACKER
    
new sipoints GetConVarInt(SSIKill);
    new 
tankpoints GetConVarInt(STankKill);
    new Class = 
GetEntProp(clientProp_Send"m_zombieClass");    
    if(
attacker && client && !IsFakeClient(attacker) && GetClientTeam(attacker) == && GetClientTeam(client) == && IsAllowedGameMode() && GetConVarInt(Enable) == && GetConVarInt(IHurt) > 0
    { 
        
hurtcount[attacker]++; 
        new 
type GetEventInt(event"type"); 
        
//PrintToChat(attacker, "Damagetype: %d", type); 
        
if( (type == 263168 || type == 265216) && hurtcount[attacker] >= 
        { 
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Spit Damage"LANG_SERVERGetConVarInt(IHurt)); 
            
points[attacker] += GetConVarInt(IHurt); 
            
hurtcount[attacker] -= 8
        }  
        else if(
type != 263168 && type != 265216 && hurtcount[attacker] >= 3
        { 
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Damage"LANG_SERVERGetConVarInt(IHurt)); 
            
points[attacker] += GetConVarInt(IHurt); 
            
hurtcount[attacker] -= 3
        }          
        else if (Class == 
8)
        {  
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"AssistTank"LANG_SERVERtankpoints GetConVarFloat(survivorDamageMultiplierTank));
            
points[attacker] += (tankpoints GetConVarFloat(survivorDamageMultiplierTank);  
        }   
        else
        {  
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"AssistSI"LANG_SERVERsipoints GetConVarFloat(survivorDamageMultiplier));
            
points[attacker] += (sipoints GetConVarFloat(survivorDamageMultiplier);  
        }   
    }     
    
AwardAssistPoints(i);
    
AssistAgainst[i][victim] = false;

WolfGang is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 03-03-2013 , 14:30   Re: [L4D2] Assist Points
Reply With Quote #6

No... read the post:

On the player hurt event, set AssistAgainst[attacker][victim] = true;
On the player death event, for (new client = 1; client <= MaxClients; client++) { if (IsClientHuman(client) && AssistAgainst[client][victim]) { AwardAssistPoints(client); AssistAgainst[client][victim] = false; }

Last edited by Skyy; 03-03-2013 at 14:31.
Skyy is offline
WolfGang
BANNED
Join Date: Oct 2010
Old 03-03-2013 , 14:54   Re: [L4D2] Assist Points
Reply With Quote #7

Final Result:

PHP Code:
stock AwardAssistPoints(client

    new 
attacker GetClientOfUserId(GetEventInt(event"attacker"));
    new Class = 
GetEntProp(clientProp_Send"m_zombieClass");
    if (Class == 
8)
    {
        new 
tankpoints GetConVarInt(STankKill);
        if(
tankpoints || GetClientTeam(client) == 3) return;
        
points[attacker] += tankpoints;
        if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Assist"LANG_SERVERtankpoints);
    }
    else 
    {
        new 
sipoints GetConVarInt(SSIKill);
        if(
sipoints || GetClientTeam(client) == || GetEntProp(clientProp_Send"m_zombieClass") == 8) return;
        
points[attacker] += sipoints;
        if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Assist"LANG_SERVERsipoints);
    }    
}

public 
Action:Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ATTACKER
    CLIENT
    
new victim GetClientOfUserId(GetEventInt(event"userid"));
    for (new 
client 1client <= MaxClientsclient++) 
    { 
        if (
IsClientHuman(client) && AssistAgainst[client][victim]) 
        { 
            
AwardAssistPoints(client); 
            
AssistAgainst[client][victim] = false
        }
    }
    if(
attacker && client && !IsFakeClient(attacker) && IsAllowedGameMode() && GetConVarInt(Enable) == 1)
    {
        
decl String:vName[MAX_NAME_LENGTH];
        
GetClientName(victimvNamesizeof(vName));
        if(
GetClientTeam(attacker) == 2)
        {
            new 
sipoints GetConVarInt(SSIKill);
            if(
sipoints || GetClientTeam(client) == || GetEntProp(clientProp_Send"m_zombieClass") == 8) return;
            new 
bool:headshot GetEventBool(event"headshot");
            if(
headshotheadshotcount[attacker]++;
            new 
headsneeded GetConVarInt(SNumberHead);
            new 
headpoints GetConVarInt(SValueHeadSpree);
            if(
headshotcount[attacker] == headsneeded && headpoints 0)
            {
                
points[attacker] += headpoints;
                
headshotcount[attacker] -= headsneeded;
                if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"SI Head Hunter"LANG_SERVERheadpoints);
            }
            
points[attacker] += sipoints;
            if(
GetConVarBool(Notifications)) CPrintToChat(attacker"%s %T"MSGTAG"Killed SI"LANG_SERVERsipointsvName);
        }
        else if(
GetClientTeam(attacker) == 3)
        {
            new 
killpoints GetConVarInt(IKill);
            if(
killpoints || GetClientTeam(client) == 3) return;
            
points[attacker] += killpoints;
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Killed Survivor"LANG_SERVERkillpointsvName);
        }    
    }
}    

public 
Action:Event_Hurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CLIENT
    ATTACKER
    
if(attacker && client && !IsFakeClient(attacker) && GetClientTeam(attacker) == && GetClientTeam(client) == && IsAllowedGameMode() && GetConVarInt(Enable) == && GetConVarInt(IHurt) > 0)
    {
        
hurtcount[attacker]++;
        new 
type GetEventInt(event"type");
        
//PrintToChat(attacker, "Damagetype: %d", type);
        
if( (type == 263168 || type == 265216) && hurtcount[attacker] >= )
        {
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Spit Damage"LANG_SERVERGetConVarInt(IHurt));
            
points[attacker] += GetConVarInt(IHurt);
            
hurtcount[attacker] -= 8;
        } 
        
/*else if(GetEntProp(attacker, Prop_Send, "m_zombieClass") == 1 && !IsPlayerAlive(attacker))
        {
            if(FindConVar("l4d_cloud_damage_enabled") != INVALID_HANDLE)
            {
                if(GetConVarInt(FindConVar("l4d_cloud_damage_enabled")) == 1 && hurtcount[attacker] >= 8 && GetEntProp(attacker, Prop_Send, "m_isGhost") != 1)
                {
                    if(GetConVarBool(Notifications)) PrintToChat(attacker, "%s %T", MSGTAG, "Cloud Damage", LANG_SERVER, GetConVarInt(IHurt));
                    points[attacker] += GetConVarInt(IHurt);
                    hurtcount[attacker] -= 10;
                }
            }    
        }*/
        
else if(type != 263168 && type != 265216 && hurtcount[attacker] >= 3)
        {
            if(
GetConVarBool(Notifications)) PrintToChat(attacker"%s %T"MSGTAG"Damage"LANG_SERVERGetConVarInt(IHurt));
            
points[attacker] += GetConVarInt(IHurt);
            
hurtcount[attacker] -= 3;
        } 
    }    
    
AssistAgainst[attacker][victim] = true;

No Luck.

Last edited by WolfGang; 03-08-2013 at 16:59. Reason: Repost
WolfGang is offline
WolfGang
BANNED
Join Date: Oct 2010
Old 03-09-2013 , 00:29   Re: [L4D2] Assist Points
Reply With Quote #8

Repost.
WolfGang is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 03-10-2013 , 00:27   Re: [L4D2] Assist Points
Reply With Quote #9

Do not "bump" your threads. Bumping is posting simply to make the thread higher in the forum sort order. I've told you everything that you need to get it to do what you want it to do, but I'm not going to write both functions out for you.
Skyy 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:26.


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