AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Trying to do custom kill feed icons (https://forums.alliedmods.net/showthread.php?t=333849)

pr0mers 08-10-2021 08:09

Trying to do custom kill feed icons
 
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

kratoss1812 08-10-2021 16:13

Re: [HELP]Trying to do custom kill feed icons
 
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;



pr0mers 08-10-2021 16:48

Re: [HELP]Trying to do custom kill feed icons
 
Quote:

Originally Posted by kratoss1812 (Post 2754986)
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

pr0mers 08-11-2021 04:56

Re: [HELP]Trying to do custom kill feed icons
 
Quote:

Originally Posted by kratoss1812 (Post 2754986)
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

kratoss1812 08-11-2021 11:19

Re: [HELP]Trying to do custom kill feed icons
 
are you sure the custom icons are valid? (precached/downloaded/working overall?)

pr0mers 08-11-2021 13:16

Re: [HELP]Trying to do custom kill feed icons
 
Quote:

Originally Posted by kratoss1812 (Post 2755063)
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 ?

kratoss1812 08-12-2021 11:56

Re: [HELP]Trying to do custom kill feed icons
 
Quote:

Originally Posted by pr0mers (Post 2755073)
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

pr0mers 08-15-2021 08:51

Re: [HELP]Trying to do custom kill feed icons
 
Quote:

Originally Posted by kratoss1812 (Post 2755122)
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


All times are GMT -4. The time now is 18:54.

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