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

[DELETED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowless
Member
Join Date: May 2018
Old 02-24-2019 , 16:01   [DELETED]
Reply With Quote #1

---

Last edited by Shadowless; 05-19-2019 at 05:48.
Shadowless is offline
Send a message via ICQ to Shadowless
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-25-2019 , 00:04   Re: Nice Killer
Reply With Quote #2

Added g_MaxClients and checked "if(1 <= Attacker <= g_MaxClients)" in hook_TakeDamage.

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

enum _:score
{
    
frags,
    
Float:dmg,
    
hs
};

new 
niceP[33][score];
new 
hudsync;
new 
g_MaxClients;

public 
plugin_init()
{
    
register_plugin("Nice Killer""1.0""Got Milk?");

    
RegisterHam(Ham_TakeDamage"player""hook_TakeDamage");
    
register_event("DeathMsg""Event_DeathMessage""a");
    
register_logevent("event_round_end"2"1=Round_End");
    
register_event("HLTV""event_round_start""a""1=0""2=0");

    
hudsync CreateHudSyncObj();
    
g_MaxClients get_maxplayers();
}

public 
event_round_end()
{
    new 
Players[32], numtmpfFloat:tmpdtmpid;
    
get_players(Playersnum);

    for(new 
i32i++)
    {
        if(
niceP[i][frags] > tmpf)
        {
            
tmpid i;
            
tmpf niceP[i][frags];
            
tmpd niceP[i][dmg];
        }
        else if(
niceP[i][frags] == tmpf && niceP[i][dmg] > tmpd)
        {
            
tmpid i;
            
tmpf niceP[i][frags];
            
tmpd niceP[i][dmg];
        }
    }

    if(
tmpf 0)
    {
        new 
name[32], msg[1024];
        
get_user_name(tmpidname31);

        
format(msgcharsmax(msg), "Best Player^n!!! %s !!!^nFor %d Frag(s) and %d Demage"nametmpffloatround(tmpdfloatround_round));

        
set_hudmessage(25500, -1.00.1705.0);
        
ShowSyncHudMsg(0hudsyncmsg);
    }
}

public 
hook_TakeDamage(VictiminflictorAttackerFloat:damagedamagebits)
{
    if(
<= Attacker <= g_MaxClients)
    {
        if(
inflictor == Attacker)
            
niceP[Attacker][dmg] += damage;
        else
        {
            new 
classname[32];
            
pev(inflictorpev_classnameclassname31);
            if(
equal(classname"grenade"))
                
niceP[Attacker][dmg] += damage;
        }

        if(
get_pdata_int(Victim755) == HIT_HEAD)
            
niceP[Attacker][hs]++;
    }

    return 
HAM_IGNORED;
}

public 
Event_DeathMessage()
{
    
niceP[read_data(1)][frags]++;
}

public 
event_round_start()
{
    for(new 
i32i++)
    {
        for(new 
j3j++)
            
niceP[i][j] = 0;
    }
}

public 
client_disconnect(id)
{
    for(new 
j3j++)
        
niceP[id][j] = 0;


Last edited by PartialCloning; 02-25-2019 at 00:04.
PartialCloning is offline
Old 02-25-2019, 14:21
Shadowless
This message has been deleted by Shadowless.
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 23:56.


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