Raised This Month: $51 Target: $400
 12% 

Solved Trying to do custom kill feed icons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pr0mers
Junior Member
Join Date: May 2020
Old 08-10-2021 , 08:09   Trying to do custom kill feed icons
Reply With Quote #1

What i tried is :
Code:
public void OnPluginStart()
{
	HookEvent("player_death", playerdied, EventHookMode_Pre);
}
public void OnMapStart()
{
	AddFileToDownloadsTable("materials/panorama/images/icons/equipment/file.svg");
}

public Action playerdied(Handle:event, const String:name[], bool:dontBroadcast){
    SetEventString(event, "weapon", "file");
}
it didn't work even though i uploaded file.svg to materials/panorama/images/icons/equipment/
i tried to use https://forums.alliedmods.net/showthread.php?t=330116 but it didn't work too.
i tried to do weapon_file,weapon_deagle,deagle instead of "file" but it always shows the gun which attacker has used not file.svg or deagle.
isn't it weird i think it should work or not show the gun in killfeed
__________________
My Steam
My Youtube Channel
My Github
My Discord : pr0mers#0369
-I always write unnecessary plugins-
(you can tell me better ways to do something, thank you)

Last edited by pr0mers; 08-15-2021 at 09:05.
pr0mers is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 08-10-2021 , 16:13   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #2

You have to stop the broadcast of the initial event, then create a new one and send it to everyone.

Credits to "Patriot of Anarchy" from HLMod.

PHP Code:
public Action Event_Death(Event event, const char[] namebool dontBroadcast)
{
    
int iClient GetClientOfUserId(event.GetInt("attacker"));
    if(!
iClient)
        return 
Plugin_Continue;

    
event.BroadcastDisabled true;

    
char buffer[124];
    
Event fake CreateEvent("player_death"true);
    
fake.SetInt("userid",            event.GetInt("userid"));
    
fake.SetInt("attacker",            event.GetInt("attacker"));
    
fake.SetInt("assister",            event.GetInt("assister"));

    
fake.SetString("weapon"buffer);

    
fake.SetInt("dominated",        event.GetInt("dominated"));
    
fake.SetInt("revenge",            event.GetInt("revenge"));
    
fake.SetInt("wipe",                event.GetInt("wipe"));
    
fake.SetInt("penetrated",        event.GetInt("penetrated"));
    
fake.SetBool("noreplay",        event.GetBool("noreplay"));

    
fake.SetBool("assistedflash",    event.GetBool("assistedflash"));
    
fake.SetBool("headshot",        event.GetBool("headshot"));
    
fake.SetBool("thrusmoke",        event.GetBool("thrusmoke"));
    
fake.SetBool("attackerblind",    event.GetBool("attackerblind"));
    
fake.SetBool("noscope",            event.GetBool("noscope"));

    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i)) fake.FireToClient(i);
    
fake.Cancel();

    return 
Plugin_Changed;

__________________
kratoss1812 is offline
pr0mers
Junior Member
Join Date: May 2020
Old 08-10-2021 , 16:48   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #3

Quote:
Originally Posted by kratoss1812 View Post
You have to stop the broadcast of the initial event, then create a new one and send it to everyone.

Credits to "Patriot of Anarchy" from HLMod.

PHP Code:
public Action Event_Death(Event event, const char[] namebool dontBroadcast)
{
    
int iClient GetClientOfUserId(event.GetInt("attacker"));
    if(!
iClient)
        return 
Plugin_Continue;

    
event.BroadcastDisabled true;

    
char buffer[124];
    
Event fake CreateEvent("player_death"true);
    
fake.SetInt("userid",            event.GetInt("userid"));
    
fake.SetInt("attacker",            event.GetInt("attacker"));
    
fake.SetInt("assister",            event.GetInt("assister"));

    
fake.SetString("weapon"buffer);

    
fake.SetInt("dominated",        event.GetInt("dominated"));
    
fake.SetInt("revenge",            event.GetInt("revenge"));
    
fake.SetInt("wipe",                event.GetInt("wipe"));
    
fake.SetInt("penetrated",        event.GetInt("penetrated"));
    
fake.SetBool("noreplay",        event.GetBool("noreplay"));

    
fake.SetBool("assistedflash",    event.GetBool("assistedflash"));
    
fake.SetBool("headshot",        event.GetBool("headshot"));
    
fake.SetBool("thrusmoke",        event.GetBool("thrusmoke"));
    
fake.SetBool("attackerblind",    event.GetBool("attackerblind"));
    
fake.SetBool("noscope",            event.GetBool("noscope"));

    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i)) fake.FireToClient(i);
    
fake.Cancel();

    return 
Plugin_Changed;

that didn't work too as i said i tried
Code:
stock Action FakeDeathEvent(Event oldEvent, char[] weapon)
{
    oldEvent.BroadcastDisabled = true;
    
    Event event_fake = CreateEvent("player_death", true);
    
    char sWeapon[64];
    Format(sWeapon, sizeof 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; i <= MaxClients; i++) if(IsClientInGame(i) && !IsFakeClient(i))
    {
        event_fake.FireToClient(i);
    }
    
    event_fake.Cancel();
    
    return Plugin_Changed;
}
which is from https://forums.alliedmods.net/showthread.php?t=330116 but this didn't work too
__________________
My Steam
My Youtube Channel
My Github
My Discord : pr0mers#0369
-I always write unnecessary plugins-
(you can tell me better ways to do something, thank you)
pr0mers is offline
pr0mers
Junior Member
Join Date: May 2020
Old 08-11-2021 , 04:56   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #4

Quote:
Originally Posted by kratoss1812 View Post
You have to stop the broadcast of the initial event, then create a new one and send it to everyone.

Credits to "Patriot of Anarchy" from HLMod.

PHP Code:
public Action Event_Death(Event event, const char[] namebool dontBroadcast)
{
    
int iClient GetClientOfUserId(event.GetInt("attacker"));
    if(!
iClient)
        return 
Plugin_Continue;

    
event.BroadcastDisabled true;

    
char buffer[124];
    
Event fake CreateEvent("player_death"true);
    
fake.SetInt("userid",            event.GetInt("userid"));
    
fake.SetInt("attacker",            event.GetInt("attacker"));
    
fake.SetInt("assister",            event.GetInt("assister"));

    
fake.SetString("weapon"buffer);

    
fake.SetInt("dominated",        event.GetInt("dominated"));
    
fake.SetInt("revenge",            event.GetInt("revenge"));
    
fake.SetInt("wipe",                event.GetInt("wipe"));
    
fake.SetInt("penetrated",        event.GetInt("penetrated"));
    
fake.SetBool("noreplay",        event.GetBool("noreplay"));

    
fake.SetBool("assistedflash",    event.GetBool("assistedflash"));
    
fake.SetBool("headshot",        event.GetBool("headshot"));
    
fake.SetBool("thrusmoke",        event.GetBool("thrusmoke"));
    
fake.SetBool("attackerblind",    event.GetBool("attackerblind"));
    
fake.SetBool("noscope",            event.GetBool("noscope"));

    for(
int i 1<= MaxClientsi++) if(IsClientInGame(i) && !IsFakeClient(i)) fake.FireToClient(i);
    
fake.Cancel();

    return 
Plugin_Changed;

sorry i accidentally opened the wrong file which was eventhookmodepostnocopy so it didn't work. Now this works if i type "weapon","deagle" but it doesn't work when i enter my custom file name (it shows nothing) and if player noscoped another player there is 2 killfeedback from 1 kill
__________________
My Steam
My Youtube Channel
My Github
My Discord : pr0mers#0369
-I always write unnecessary plugins-
(you can tell me better ways to do something, thank you)

Last edited by pr0mers; 08-11-2021 at 04:58.
pr0mers is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 08-11-2021 , 11:19   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #5

are you sure the custom icons are valid? (precached/downloaded/working overall?)
__________________
kratoss1812 is offline
pr0mers
Junior Member
Join Date: May 2020
Old 08-11-2021 , 13:16   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #6

Quote:
Originally Posted by kratoss1812 View Post
are you sure the custom icons are valid? (precached/downloaded/working overall?)
i did
Code:
	AddFileToDownloadsTable("materials/panorama/images/icons/equipment/file.svg");
	PrecacheGeneric("file.svg", true);
onmapstart it didn't work i tried
Code:
PrecacheGeneric("materials/panorama/images/icons/equipment/file.svg", true);
but this didn't work too am i doing something wrong?

does the .svg have to be fixed size something like 64x64 ? and does the .svg have to contain only 1 color etc? is there any restriction for the .svg file ?
__________________
My Steam
My Youtube Channel
My Github
My Discord : pr0mers#0369
-I always write unnecessary plugins-
(you can tell me better ways to do something, thank you)

Last edited by pr0mers; 08-12-2021 at 06:39.
pr0mers is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 08-12-2021 , 11:56   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #7

Quote:
Originally Posted by pr0mers View Post
i did [CODE]
does the .svg have to be fixed size something like 64x64 ? and does the .svg have to contain only 1 color etc? is there any restriction for the .svg file ?
i do not know but you could try some valid .svg files (that already works on other servers, etc) and see if the issue is from the plugin or from the files
__________________
kratoss1812 is offline
pr0mers
Junior Member
Join Date: May 2020
Old 08-15-2021 , 08:51   Re: [HELP]Trying to do custom kill feed icons
Reply With Quote #8

Quote:
Originally Posted by kratoss1812 View Post
i do not know but you could try some valid .svg files (that already works on other servers, etc) and see if the issue is from the plugin or from the files
yeah... my bad the issue was from .svg but i don't know why my svgs doesn't work it has to do something with png to svg convertion sites. Thanks anyways

and it workes fine when i do SetEventString(event,"weapon","filenamehere") so no need to make fake event
__________________
My Steam
My Youtube Channel
My Github
My Discord : pr0mers#0369
-I always write unnecessary plugins-
(you can tell me better ways to do something, thank you)

Last edited by pr0mers; 08-15-2021 at 09:04.
pr0mers 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 05:35.


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