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

Can someone fix this plugin ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GBLTeam
Senior Member
Join Date: Mar 2012
Location: Republic of Macedonia
Old 05-18-2019 , 08:50   Can someone fix this plugin ?
Reply With Quote #1

I need someone to fix the green/blue/red to go fast, because now when someone is killed the green take a while to get removed and like on every kill you need to wait few seconds to loose the green, because now all screen goes green on kill, and all screen when you get killed goes red.

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "Kill Bonuses"
#define VERSION "1.0"
#define AUTHOR "Flicker"

#define FFADE_IN 0x0000

const MAX_HP = 150     //Max health
const BONUS_HEAD = 8     //Headshot kil
const BONUS_GREN = 10    //Grenade kill
const BONUS_KNIFE = 15     //Knife kill
const BONUS_NORMAL = 5     //Normal kill

new g_msgScreenFade

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("DeathMsg", "onDeathMsgEvent", "a")
    
    g_msgScreenFade = get_user_msgid("ScreenFade")
}

public onDeathMsgEvent()
{
    new killer = read_data(1)
    new victim = read_data(2)
    
    new szWeapon[32]
    read_data(4, szWeapon, charsmax(szWeapon))
    
    if(victim == killer || !is_user_alive(killer))
        return PLUGIN_HANDLED
    
    new bonus
    
    if(equali(szWeapon, "knife"))
        bonus = BONUS_KNIFE
    else if(equali(szWeapon, "grenade"))
        bonus = BONUS_GREN
    else if(read_data(3))
        bonus = BONUS_HEAD
    else
        bonus =BONUS_NORMAL
    
    set_bonus_hp(killer, bonus)
    
    
    
    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade,_, killer)
    write_short(4096)
    write_short(4096)
    write_short(FFADE_IN)
    write_byte (0)         //Red
    write_byte (255)    //Green
    write_byte (0)         //Blue
    write_byte (255)
    message_end()
    
    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade,_, victim)
    write_short(4096)
    write_short(4096)
    write_short(FFADE_IN)
    write_byte (255)    //Red
    write_byte (0)        //Green
    write_byte (0)        //Blue
    write_byte (255)
    message_end()
    
    
    return PLUGIN_CONTINUE
}

stock set_bonus_hp(const id, const hp)
    set_user_health(id, clamp(get_user_health(id) + hp, 0, MAX_HP))
GBLTeam is offline
Send a message via MSN to GBLTeam Send a message via Skype™ to GBLTeam
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-18-2019 , 16:40   Re: Can someone fix this plugin ?
Reply With Quote #2

4096 equals 1 second, change it to something lower, like 2048 for example.
__________________
<VeCo> is offline
GBLTeam
Senior Member
Join Date: Mar 2012
Location: Republic of Macedonia
Old 05-18-2019 , 17:27   Re: Can someone fix this plugin ?
Reply With Quote #3

Quote:
Originally Posted by <VeCo> View Post
4096 equals 1 second, change it to something lower, like 2048 for example.
Thanks, and is possible to remove the colors like to not show the green and red?
GBLTeam is offline
Send a message via MSN to GBLTeam Send a message via Skype™ to GBLTeam
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-18-2019 , 17:32   Re: Can someone fix this plugin ?
Reply With Quote #4

code with all screen fades removed:
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "Kill Bonuses"
#define VERSION "1.0"
#define AUTHOR "Flicker"

const MAX_HP = 150     //Max health
const BONUS_HEAD = 8     //Headshot kil
const BONUS_GREN = 10    //Grenade kill
const BONUS_KNIFE = 15     //Knife kill
const BONUS_NORMAL = 5     //Normal kill

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("DeathMsg", "onDeathMsgEvent", "a")
}

public onDeathMsgEvent()
{
    new killer = read_data(1)
    new victim = read_data(2)
    
    new szWeapon[32]
    read_data(4, szWeapon, charsmax(szWeapon))
    
    if(victim == killer || !is_user_alive(killer))
        return PLUGIN_HANDLED
    
    new bonus
    
    if(equali(szWeapon, "knife"))
        bonus = BONUS_KNIFE
    else if(equali(szWeapon, "grenade"))
        bonus = BONUS_GREN
    else if(read_data(3))
        bonus = BONUS_HEAD
    else
        bonus =BONUS_NORMAL
    
    set_bonus_hp(killer, bonus)
    
    return PLUGIN_CONTINUE
}

stock set_bonus_hp(const id, const hp)
    set_user_health(id, clamp(get_user_health(id) + hp, 0, MAX_HP))
__________________
<VeCo> 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 17:51.


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