View Single Post
Author Message
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 01-21-2021 , 04:50   [STOCK] Custom kill message icons
Reply With Quote #1

It's been a long time since my last contribution to this forum section or at all
So what do I have here to share with you today?
It's an example code of something I've used in many ways for different private plugins already.



The snipped shows you how to use custom icons inside the killfeed. The attached example plugin adds an icon for deaths caused by fall damage, but you can use it for many other things too.

PHP Code:
stock Action FakeDeathEvent(Event oldEventchar[] weapon)
{
    
oldEvent.BroadcastDisabled true;
    
    
Event event_fake CreateEvent("player_death"true);
    
    
char sWeapon[64];
    
Format(sWeaponsizeof sWeapon"weapon_%s"weapon); // trys to use materials/panorama/images/icons/equipment/<WEAPONNAME>.svg
    
event_fake.SetString("weapon"sWeapon);
    
    
event_fake.SetInt("userid"oldEvent.GetInt("userid"));
    
event_fake.SetInt("attacker"oldEvent.GetInt("attacker"));
    
    
event_fake.SetInt("assister"oldEvent.GetInt("assister"));
    
event_fake.SetBool("assistedflash"oldEvent.GetBool("assistedflash"));
    
event_fake.SetBool("headshot"oldEvent.GetBool("headshot"));
    
event_fake.SetBool("dominated"oldEvent.GetBool("dominated"));
    
event_fake.SetBool("revenge"oldEvent.GetBool("revenge"));
    
event_fake.SetBool("wipe"oldEvent.GetBool("wipe"));
    
event_fake.SetBool("penetrated"oldEvent.GetBool("penetrated"));
    
event_fake.SetBool("noreplay"oldEvent.GetBool("noreplay"));
    
event_fake.SetBool("noscope"oldEvent.GetBool("noscope"));
    
event_fake.SetBool("thrusmoke"oldEvent.GetBool("thrusmoke"));
    
event_fake.SetBool("attackerblind"oldEvent.GetBool("attackerblind"));
    
    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i))
    {
        
event_fake.FireToClient(i);
    }
    
    
event_fake.Cancel();
    
    return 
Plugin_Changed;

If you plan to use this for your own servers, please choose unique filenames which include a shortcut of your communityname as a prefix or something, thanks.


.
Attached Files
File Type: sp Get Plugin or Get Source (killfeed_falldamage_icon.sp - 367 views - 3.0 KB)
File Type: zip materials.zip (2.7 KB, 244 views)
__________________
zipcore is offline