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

event_playerkiller


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yagami
Senior Member
Join Date: Jan 2021
Old 07-24-2023 , 07:48   event_playerkiller
Reply With Quote #1

I'm almost 6 days without sleep right, waiting for help, I searched this forum upside down, searched more 50 plugins and could not make menu, nobody wanted to help me make menu ook

Can someone at least help me how do I reset skill if player dies?


PHP Code:
                if(pCash[id] >= get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                {
                    if(
pDamage[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
pDamage[id] = true
                    csr_set_user_points
(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE])))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Dobro Dano"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
1:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                {
                    if(
pInvisible[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
fPtime[id] = halflife_time() + 20
                    pInvisible
[id] = true
                    csr_set_user_points
(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE])))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Invisibilidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)

                    return 
PLUGIN_HANDLED
                
}
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
2:
            { 
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                {

                    if(
pHealthRegen[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
pHealthRegen[id] = true 
                    set_task
(0.25"player_AdrenalineDrain"id+TASK_HP, .flags="b")


                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Regenerar HP"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
3:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SPEED_PRICE]))
                {
                    if(
pSpeed[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED

                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
player_updateSpeed(id)
                    
pSpeed[id] = true
                    client_print_color
(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Velocidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
4:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_ICE_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_ICE_PRICE])))
                    
client_cmd(id"say /fn")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Granada De Gelo"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }






public 
AddToFullPack(eseenthostflagsplayerset)
{
    if(!
player)
    {
        return
    }
    
    if(
pInvisible[ent])
    {
        
set_es(esES_EffectsEF_NODRAW)
        
client_print(entprint_center"Invisibilidade: %0.1f segundo%s"fPtime[ent] - halflife_time(), (fPtime[ent] - halflife_time() > 1.9 "s" ""))
        if(
halflife_time() >= fPtime[ent] - 0.1)
        {
            
client_print_color(entprint_team_default"%s ^1Sua ^4invisibilidade ^1acabou"PREFIX_CHAT)
            
pInvisible[ent] = false
        
}
    }
}


public 
player_AdrenalineDrain(taskid)
{
    new 
id taskid TASK_HP
    
new iHealth pev(idpev_health)
    
    if(
iHealth 150)
    {
        
set_pev(idpev_healthiHealth 1.0)
    }
    else
    {
        
remove_task(id+TASK_HP)
        
client_print_color(idprint_team_default"%s ^1Sua ^4Reg Vida ^1foi concluída")
        
pHealthRegen[id] = false
    
}
}

player_updateSpeed(id)
{
    
// Float
    
new Float:fSpeed 1.0
    
    fSpeed 
*= SPEED_ADRENALINE;

    
// SPED
    
set_user_maxspeed(idg_fWeaponSpeed[id] * fSpeed)

yagami is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-24-2023 , 08:13   Re: event_playerkiller
Reply With Quote #2

2 options here (Probably even more but the easiest ones at least): hook Ham_Killed using hamsandwich and disable the skill when the player has died.

Other option is to register the DeathMsg event and do the same thing as you would with hamdsandwich.

If you don't know how to do this, there's lots of topics which u can search for.
__________________

Last edited by Napoleon_be; 07-24-2023 at 08:14.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
yagami
Senior Member
Join Date: Jan 2021
Old 07-24-2023 , 08:36   Re: event_playerkiller
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
2 options here (Probably even more but the easiest ones at least): hook Ham_Killed using hamsandwich and disable the skill when the player has died.

Other option is to register the DeathMsg event and do the same thing as you would with hamdsandwich.

If you don't know how to do this, there's lots of topics which u can search for.
Like I've been trying to make this menu for 5 days, 5 days, I don't even know how I got here, I asked for help on allied discord, I begged for help I begged for God and witness and so far no one has helped me, I just wanted to make simple menu with what I had
Double Damage, Invisibility, Reg Life, Speed only that the rest I turned around, I looked almost 60 pages here in allied researching, I downloaded so much from so many places that I don't even know how my pc didn't catch a virus, I'm not sleeping almost 16 hours trying to do this a simple menu only this a simple menu

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike>
#include <fakemeta> 
#include <fun> 
#include <hamsandwich>

#define PREFIX_CHAT "^4[^3Express^4]"

native Float:halflife_time();
native csr_get_user_points(id);
native csr_set_user_points(idamount);

static const 
NO_POWER_SELECTED = -1
static const TASK_RESET_POWER 13312
static const TASK_HP 55443
const Float:SPEED_ADRENALINE =            1.3    

enum
{
    
DOUBLE_DAMAGE,
    
INVISIBILITY,
    
REGLIFE
    
SPEED
}


enum _:g_Mag_Cvar
{
    
CVAR_DAMAGE_PRICE,
    
CVAR_INVISI_PRICE,
    
CVAR_REGLIFE_PRICE,
    
CVAR_SPEED_PRICE,
    
CVAR_ICE_PRICE
    
CVAR_AWP_PRICE,
    
CVAR_TECTEC_PRICE,
    
CVAR_SCOUT_PRICE,
    
CVAR_GRENADE_PRICE,
    
CVAR_SHIELD_PRICE
}

new 
g_Cvar[g_Mag_Cvar], pCash[33]
new 
g_iCurrentPower[MAX_PLAYERS 1]
new 
bool:g_iBuy[MAX_PLAYERS]
new 
Float:fPtime[MAX_PLAYERS]
new 
bool:g_iBuy2[MAX_PLAYERS]
new 
Float:g_fWeaponSpeed[33]
new 
Float:g_iBuyDamage[MAX_PLAYERS]


public 
plugin_init()
{
    
register_plugin("Shop Menu""1.0""SETT")

    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
    
register_forward(FM_AddToFullPack"AddToFullPack"1)

    
g_Cvar[CVAR_DAMAGE_PRICE] = create_cvar("csr_damage""10")
    
g_Cvar[CVAR_INVISI_PRICE] = create_cvar("csr_invisibily""10")
    
g_Cvar[CVAR_REGLIFE_PRICE] = create_cvar("csr_reglife""10")
    
g_Cvar[CVAR_SPEED_PRICE] = create_cvar("csr_speed""10")
    
g_Cvar[CVAR_ICE_PRICE] = create_cvar("csr_ice""10")
    
g_Cvar[CVAR_AWP_PRICE] = create_cvar("csr_awp""10")
    
g_Cvar[CVAR_TECTEC_PRICE] = create_cvar("csr_tec""10")
    
g_Cvar[CVAR_SCOUT_PRICE] = create_cvar("csr_scout""10")
    
g_Cvar[CVAR_GRENADE_PRICE] = create_cvar("csr_grenade""10")
    
g_Cvar[CVAR_SHIELD_PRICE] = create_cvar("csr_grenade""10")


    
register_clcmd("say /loja""xShopMenu")
}

public 
Ham_TakeDamage_Pre(const iVictim, const iAttackerFloat:fDamageiDamgeBits)
{
    if(
iVictim == iAttacker)
    {
        return 
HAM_IGNORED
    
}
 
    if(
g_iCurrentPower[iAttacker] == DOUBLE_DAMAGE)
    {
        
SetHamParamFloat(4fDamage 2.0)
        return 
HAM_HANDLED
    
}

    return 
HAM_IGNORED
}

public 
client_disconnected(id)
{
    
g_iBuy[id] = false
    g_iBuy2
[id] = false
}

public 
client_putinserver(id)
{
    if(
g_iBuy[id] || task_exists(id+TASK_HP))
    {
        
remove_task(id+TASK_HP)
        
g_iBuy[id] = false
    
}
}

public 
client_connect(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
xShopMenu(id)
{
    new 
szTitle[256]
    
formatex(szTitlecharsmax(szTitle), "\rShop Menu \d|| \wExtra items^n \dCASH %d"csr_get_user_points(id))

    new 
pMenu menu_create(szTitle"xShopMenuHandle")

    
formatex(szTitlecharsmax(szTitle), "Damage 2x \r[Doubre Damage] \d[%d]"get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE])),
    
menu_additem(pMenuszTitle"0");

    
formatex(szTitlecharsmax(szTitle), "Invisibility \r[15 Second] \d[%d]"get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE])),
    
menu_additem(pMenuszTitle"1");

    
formatex(szTitlecharsmax(szTitle), "Regenerating Life \r[Regeret Life] \d[%d]"get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])),
    
menu_additem(pMenuszTitle"2");

    
formatex(szTitlecharsmax(szTitle), "Speed \r[15] \d[%d]"get_pcvar_num(g_Cvar[CVAR_SPEED_PRICE]));
    
menu_additem(pMenuszTitle"3"),

    
formatex(szTitlecharsmax(szTitle), "Ice Grenade \r[Freeze] \d[%d]"get_pcvar_num(g_Cvar[CVAR_ICE_PRICE])),
    
menu_additem(pMenuszTitle"4");      

    
formatex(szTitlecharsmax(szTitle), "AWP \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_AWP_PRICE])),
    
menu_additem(pMenuszTitle"5");

    
formatex(szTitlecharsmax(szTitle), "TEC TEC \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE])),
    
menu_additem(pMenuszTitle"6");

    
formatex(szTitlecharsmax(szTitle), "Scout \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE])),
    
menu_additem(pMenuszTitle"7");

    
formatex(szTitlecharsmax(szTitle), "KIT Grenade \r[Grenade] \r[%d]"get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE])),
    
menu_additem(pMenuszTitle"8");

    
formatex(szTitlecharsmax(szTitle), "Escudo \r[Escudo] \r[%d]"get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE])),
    
menu_additem(pMenuszTitle"9");


    
menu_setprop(pMenuMPROP_EXITMEXIT_ALL)
    
menu_setprop(pMenuMPROP_BACKNAME"Voltar")
    
menu_setprop(pMenuMPROP_NEXTNAME"Proximo")
    
menu_setprop(pMenuMPROP_EXITNAME"Sair")

    
menu_display(idpMenu0)

    return 
PLUGIN_HANDLED
}

public 
xShopMenuHandle(idpMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(pMenu)
        return 
PLUGIN_HANDLED
    
}

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(pMenuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    
pCash[id] = csr_get_user_points(id)

    new 
pKey str_to_num(szData)
    {
        switch(
pKey)
        {
            case 
0:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                {
                    if(
g_iBuyDamage[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE])))
                    
g_iCurrentPower[id] = DOUBLE_DAMAGE
                    set_task
(30.0"reset_user_power"id TASK_RESET_POWER)
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Dobro Dano"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
1:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                {
                    if(
g_iBuy2[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE])))
                    
fPtime[id] = halflife_time() + 20
                    g_iBuy2
[id] = true
                    client_print_color
(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Invisibilidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)

                    return 
PLUGIN_HANDLED
                
}
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
2:
            { 
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                {
                    if(
g_iBuy[id] || task_exists(id+TASK_HP))
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
g_iBuy[id] = true 
                    set_task
(0.25"player_AdrenalineDrain"id+TASK_HP, .flags="b")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Regenerar HP"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
3:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SPEED_PRICE]))
                {
                    if(
pSpeed[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
player_updateSpeed(id)
                    
pSeed[id] = true 
                    client_print_color
(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Velocidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
4:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_ICE_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_ICE_PRICE])))
                    
give_item(id"weapon_smokegrenade")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Granada De Gelo"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
5:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_AWP_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_AWP_PRICE])))
                    
give_item(id"weapon_awp")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: AWP"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d CASH"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                } 

            }
            case 
6:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE])))
                    
give_item(id"weapon_g3sg1")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Tec Tec"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
7:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE])))
                    
give_item(id"weapon_scout")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Scout"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
8:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE])))
                    
give_item(id"weapon_hegranade")
                    
give_item(id"weapon_smokegrenade")
                    
give_item(id"weapon_flashbang")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Kit Granada"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)

                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
9:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE])))
                    
give_item(id"weapon_shield")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Escudo"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)             
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
        }
    }
    return 
PLUGIN_HANDLED
}


public 
AddToFullPack(eseenthostflagsplayerset)
{
    if(!
player)
    {
        return
    }
    
    if(
g_iBuy2[ent])
    {
        
set_es(esES_EffectsEF_NODRAW)
        
client_print(entprint_center"Invisibilidade: %0.1f segundo%s"fPtime[ent] - halflife_time(), (fPtime[ent] - halflife_time() > 1.9 "s" ""))
        if(
halflife_time() >= fPtime[ent] - 0.1)
        {
            
client_print_color(entprint_team_default"%s ^1Sua ^4invisibilidade ^1acabou"PREFIX_CHAT)
            
g_iBuy2[ent] = false
        
}
    }
}


public 
player_AdrenalineDrain(taskid)
{
    new 
id taskid TASK_HP
    
new iHealth pev(idpev_health)
    
    if(
iHealth 150)
    {
        
set_pev(idpev_healthiHealth 1.0)
    }
    else
    {
        
remove_task(id+TASK_HP)
        
client_print_color(idprint_team_default"%s ^1Sua ^4Reg Vida ^1foi concluída")
        
g_iBuy[id] = false
    
}
    
//player_healingEffect(id)
}

player_updateSpeed(id)
{
    
// Float
    
new Float:fSpeed 1.0
    
    fSpeed 
*= SPEED_ADRENALINE;

    
// SPED
    
set_user_maxspeed(idg_fWeaponSpeed[id] * fSpeed)

This is the best I could do
yagami is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-24-2023 , 13:21   Re: event_playerkiller
Reply With Quote #4

disable user power as napoleon said, when player is dying (pre, not post).

use ham hook Ham_CS_Player_ResetMaxSpeed to set player speed

set_user_rendering for invisibility?


for hp regen, after buying the hp regen power, start a task on user id to add health.


the double damage i gave you doesn't work?

Last edited by lexzor; 07-24-2023 at 13:21.
lexzor is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-24-2023 , 13:24   Re: event_playerkiller
Reply With Quote #5

Sometimes you need to ask yourself does it really worth it?

If you want to make your life easier just hire someone expert.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-24-2023 at 13:24.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-24-2023 , 13:33   Re: event_playerkiller
Reply With Quote #6

maybe this will help u:

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <hamsandwich>
#include <fakemeta>

native csr_get_user_points(id);
native csr_set_user_points(idamount);
native csr_save_user_points(id);

static const 
NO_POWER_SELECTED = -1
static const TASK_RESET_POWER 13312

enum
{
    
DOUBLE_DAMAGE,
    
INVISIBILITY,
    
HP_REGEN
}

enum ( += 1231)
{
    
INV_TASK 1321,
    
REGEN_TASK
}

new 
g_iCurrentPower[MAX_PLAYERS 1]

public 
plugin_init()
{
    
register_plugin("Shop Menu""1.0""SETT")

    
register_clcmd("say /loja""xShopMenu")

    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""fwResetMaxSpeed")
}

public 
Ham_TakeDamage_Pre(const iVictim, const iAttackerFloat:fDamageiDamgeBits)
{
    if(
iVictim == iAttacker)
    {
        return 
HAM_IGNORED
    
}

    
//check everytime someone get damage if it's attacker has de double damage power selected 
    
if(g_iCurrentPower[iAttacker] == DOUBLE_DAMAGE)
    {
        
//set the damage value x2
        
SetHamParamFloat(4fDamage 2.0)
        return 
HAM_HANDLED
    
}

    return 
HAM_IGNORED
}

public 
fwResetMaxSpeed(id)
{
    if(
is_user_alive(id))
    {
        if(
pev_valid(id))
        {
            
set_pev(idpev_speedpev(idpev_speed) * 1.2)
        }
    }
}

public 
client_connect(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
xShopMenu(id)
{
    new 
szTitle[256]
    
formatex(szTitlecharsmax(szTitle), "Shop Menu")

    new 
pMenu menu_create(szTitle"xShopMenuHandle")

    
formatex(szTitlecharsmax(szTitle), "Damage 2x[Doubre Damage][]150");
    
menu_additem(pMenuszTitle"1"); 

    
formatex(szTitlecharsmax(szTitle), "Invisibility[15 Second][]500");
    
//you are using data parametere of menu_additem wrong, loon in item handler
    
menu_additem(pMenuszTitle"2");

    
menu_setprop(pMenuMPROP_EXITMEXIT_ALL)
    
menu_setprop(pMenuMPROP_BACKNAME"Voltar")
    
menu_setprop(pMenuMPROP_NEXTNAME"Proximo")
    
menu_setprop(pMenuMPROP_EXITNAME"Sair")

    
menu_display(idpMenu0)

    
// you don't need that in that case if you don't use return in your function
    // return PLUGIN_HANDLED
}

public 
xShopMenuHandle(idpMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(pMenu)
        return 
PLUGIN_HANDLED
    
}

    
/**
        item value it's the value of the pressed user button, if you want to use that data parameter of the menu_additem to something like this
     */

    
new szMenuItemData[3]
    
menu_item_getinfo(pMenuitem_szMenuItemDatacharsmax(szMenuItemData), ___)
    new 
iMenuItemData str_to_num(szMenuItemData)
    
client_print(idprint_chat"Yay, u pressed button %i but it's data is  %i"itemiMenuItemData)

    switch(
item)
    {
        case 
0:
        {
            
//let's say the user choose the damage button

            //you set him the power
            
g_iCurrentPower[id] = DOUBLE_DAMAGE
            
//don't forget you want to reset it, let's say you want to give him this power 30 seconds

            
set_task(30.0"reset_user_power"id TASK_RESET_POWER)
        }
        case 
1//inv
        
{
            
g_iCurrentPower[id] = INVISIBILITY
            
            set_user_rendering
(idkRenderFxNone000kRenderTransAlpha0)
            
set_task(5.0"make_player_visible"id INV_TASK)
        }
        case 
2// regen
        
{
            
g_iCurrentPower[id] = HP_REGEN

            set_task
(1.0"add_player_hp"id HP_REGEN, .flags "b")
            
set_task(25.0"remove_hp_regen_power"id 231312)

        }
    }
    return 
PLUGIN_HANDLED


public 
add_player_hp(id)
{
    if(
is_user_alive(id) && pev_valid(id))
    {
        
set_pev(idpev_healthpev(idpev_health) + 2)
    }
}

public 
remove_hp_regen_power(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
    
if(task_exists(id HP_REGEN))
    {
        
remove_task(id HP_REGEN)
    }
}

public 
make_player_visible(id)
{
    
id -= INV_TASK

    set_user_rendering
(idkRenderFxNone000kRenderTransAlpha0)
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
reset_user_power(id)
{
    
id -= TASK_RESET_POWER

    g_iCurrentPower
[id] = NO_POWER_SELECTED

lexzor is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-24-2023 , 18:33   Re: event_playerkiller
Reply With Quote #7

Quote:
Originally Posted by lexzor View Post
maybe this will help u:

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <hamsandwich>
#include <fakemeta>

native csr_get_user_points(id);
native csr_set_user_points(idamount);
native csr_save_user_points(id);

static const 
NO_POWER_SELECTED = -1
static const TASK_RESET_POWER 13312

enum
{
    
DOUBLE_DAMAGE,
    
INVISIBILITY,
    
HP_REGEN
}

enum ( += 1231)
{
    
INV_TASK 1321,
    
REGEN_TASK
}

new 
g_iCurrentPower[MAX_PLAYERS 1]

public 
plugin_init()
{
    
register_plugin("Shop Menu""1.0""SETT")

    
register_clcmd("say /loja""xShopMenu")

    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""fwResetMaxSpeed")
}

public 
Ham_TakeDamage_Pre(const iVictim, const iAttackerFloat:fDamageiDamgeBits)
{
    if(
iVictim == iAttacker)
    {
        return 
HAM_IGNORED
    
}

    
//check everytime someone get damage if it's attacker has de double damage power selected 
    
if(g_iCurrentPower[iAttacker] == DOUBLE_DAMAGE)
    {
        
//set the damage value x2
        
SetHamParamFloat(4fDamage 2.0)
        return 
HAM_HANDLED
    
}

    return 
HAM_IGNORED
}

public 
fwResetMaxSpeed(id)
{
    if(
is_user_alive(id))
    {
        if(
pev_valid(id))
        {
            
set_pev(idpev_speedpev(idpev_speed) * 1.2)
        }
    }
}

public 
client_connect(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
xShopMenu(id)
{
    new 
szTitle[256]
    
formatex(szTitlecharsmax(szTitle), "Shop Menu")

    new 
pMenu menu_create(szTitle"xShopMenuHandle")

    
formatex(szTitlecharsmax(szTitle), "Damage 2x[Doubre Damage][]150");
    
menu_additem(pMenuszTitle"1"); 

    
formatex(szTitlecharsmax(szTitle), "Invisibility[15 Second][]500");
    
//you are using data parametere of menu_additem wrong, loon in item handler
    
menu_additem(pMenuszTitle"2");

    
menu_setprop(pMenuMPROP_EXITMEXIT_ALL)
    
menu_setprop(pMenuMPROP_BACKNAME"Voltar")
    
menu_setprop(pMenuMPROP_NEXTNAME"Proximo")
    
menu_setprop(pMenuMPROP_EXITNAME"Sair")

    
menu_display(idpMenu0)

    
// you don't need that in that case if you don't use return in your function
    // return PLUGIN_HANDLED
}

public 
xShopMenuHandle(idpMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(pMenu)
        return 
PLUGIN_HANDLED
    
}

    
/**
        item value it's the value of the pressed user button, if you want to use that data parameter of the menu_additem to something like this
     */

    
new szMenuItemData[3]
    
menu_item_getinfo(pMenuitem_szMenuItemDatacharsmax(szMenuItemData), ___)
    new 
iMenuItemData str_to_num(szMenuItemData)
    
client_print(idprint_chat"Yay, u pressed button %i but it's data is  %i"itemiMenuItemData)

    switch(
item)
    {
        case 
0:
        {
            
//let's say the user choose the damage button

            //you set him the power
            
g_iCurrentPower[id] = DOUBLE_DAMAGE
            
//don't forget you want to reset it, let's say you want to give him this power 30 seconds

            
set_task(30.0"reset_user_power"id TASK_RESET_POWER)
        }
        case 
1//inv
        
{
            
g_iCurrentPower[id] = INVISIBILITY
            
            set_user_rendering
(idkRenderFxNone000kRenderTransAlpha0)
            
set_task(5.0"make_player_visible"id INV_TASK)
        }
        case 
2// regen
        
{
            
g_iCurrentPower[id] = HP_REGEN

            set_task
(1.0"add_player_hp"id HP_REGEN, .flags "b")
            
set_task(25.0"remove_hp_regen_power"id 231312)

        }
    }
    return 
PLUGIN_HANDLED


public 
add_player_hp(id)
{
    if(
is_user_alive(id) && pev_valid(id))
    {
        
set_pev(idpev_healthpev(idpev_health) + 2)
    }
}

public 
remove_hp_regen_power(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
    
if(task_exists(id HP_REGEN))
    {
        
remove_task(id HP_REGEN)
    }
}

public 
make_player_visible(id)
{
    
id -= INV_TASK

    set_user_rendering
(idkRenderFxNone000kRenderTransAlpha0)
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
reset_user_power(id)
{
    
id -= TASK_RESET_POWER

    g_iCurrentPower
[id] = NO_POWER_SELECTED

I did it this way and it is still not resetting when I die
I did it this way and it's still not resetting when I die, but everything is working, only event_playerkiller even


THANK YOU VERY MUCH

Napoleon_be, lexzor, Natsheh



PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike>
#include <fakemeta> 
#include <fun> 
#include <hamsandwich>

#define PREFIX_CHAT "^4[^3Express^4]"

native Float:halflife_time();
native csr_get_user_points(id);
native csr_set_user_points(idamount);

static const 
NO_POWER_SELECTED = -1
static const TASK_RESET_POWER 13312
const Float:SPEED_ADRENALINE =            1.3    



enum
{
    
DOUBLE_DAMAGE,
    
INVISIBILITY,
    
HP_REGEN,
    
SPEED
}

enum ( += 1231)
{
    
INV_TASK 1321,
    
REGEN_TASK
}

enum _:g_Mag_Cvar
{
    
CVAR_DAMAGE_PRICE,
    
CVAR_INVISI_PRICE,
    
CVAR_REGLIFE_PRICE,
    
CVAR_SPEED_PRICE,
    
CVAR_ICE_PRICE
    
CVAR_AWP_PRICE,
    
CVAR_TECTEC_PRICE,
    
CVAR_SCOUT_PRICE,
    
CVAR_GRENADE_PRICE,
    
CVAR_SHIELD_PRICE
}

new 
g_Cvar[g_Mag_Cvar], pCash[33]
new 
g_iCurrentPower[MAX_PLAYERS 1]
new 
Float:fPtime[MAX_PLAYERS]
new 
Float:g_fWeaponSpeed[33]


new 
bool:pDamage[33]
new 
bool:pInvisible[33]
new 
bool:pHealthRegen[33]
new 
bool:pSpeed[33]


public 
plugin_init()
{
    
register_plugin("Shop Menu""1.0""SETT")

    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
    
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""fwResetMaxSpeed")
    
register_forward(FM_AddToFullPack"AddToFullPack"1)

    
g_Cvar[CVAR_DAMAGE_PRICE] = create_cvar("csr_damage""10")
    
g_Cvar[CVAR_INVISI_PRICE] = create_cvar("csr_invisibily""10")
    
g_Cvar[CVAR_REGLIFE_PRICE] = create_cvar("csr_reglife""10")
    
g_Cvar[CVAR_SPEED_PRICE] = create_cvar("csr_speed""10")
    
g_Cvar[CVAR_ICE_PRICE] = create_cvar("csr_ice""10")
    
g_Cvar[CVAR_AWP_PRICE] = create_cvar("csr_awp""10")
    
g_Cvar[CVAR_TECTEC_PRICE] = create_cvar("csr_tec""10")
    
g_Cvar[CVAR_SCOUT_PRICE] = create_cvar("csr_scout""10")
    
g_Cvar[CVAR_GRENADE_PRICE] = create_cvar("csr_grenade""10")
    
g_Cvar[CVAR_SHIELD_PRICE] = create_cvar("csr_grenade""10")


    
register_clcmd("say /loja""xShopMenu")
}

public 
Ham_TakeDamage_Pre(const iVictim, const iAttackerFloat:fDamageiDamgeBits)
{
    if(
iVictim == iAttacker)
    {
        return 
HAM_IGNORED
    
}
 
    if(
g_iCurrentPower[iAttacker] == DOUBLE_DAMAGE)
    {
        
SetHamParamFloat(4fDamage 2.0)
        return 
HAM_HANDLED
    
}

    return 
HAM_IGNORED
}

public 
fwResetMaxSpeed(id)
{
    if(
is_user_alive(id))
    {
        if(
pev_valid(id))
        {
            
set_pev(idpev_speedpev(idpev_speed) * 1.2)
        }
    }
}


public 
client_disconnected(id)
{
    
pDamage[id] = false
    pSpeed
[id] = false 
    pHealthRegen
[id] = false
    pInvisible
[id] = false

}

public 
client_putinserver(id)
{
    if(
pHealthRegen[id] || task_exists(id+HP_REGEN))
    {
        
remove_task(id+HP_REGEN)
        
pHealthRegen[id] = false
    
}
}

public 
client_connect(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}

public 
xShopMenu(id)
{
    new 
szTitle[256]
    
formatex(szTitlecharsmax(szTitle), "\rShop Menu \d|| \wExtra items^n \dCASH %d"csr_get_user_points(id))

    new 
pMenu menu_create(szTitle"xShopMenuHandle")

    
formatex(szTitlecharsmax(szTitle), "Damage 2x \r[Doubre Damage] \d[%d]"get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE])),
    
menu_additem(pMenuszTitle"0");

    
formatex(szTitlecharsmax(szTitle), "Invisibility \r[15 Second] \d[%d]"get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE])),
    
menu_additem(pMenuszTitle"1");

    
formatex(szTitlecharsmax(szTitle), "Regenerating Life \r[Regeret Life] \d[%d]"get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])),
    
menu_additem(pMenuszTitle"2");

    
formatex(szTitlecharsmax(szTitle), "Speed \r[15] \d[%d]"get_pcvar_num(g_Cvar[CVAR_SPEED_PRICE]));
    
menu_additem(pMenuszTitle"3"),

    
formatex(szTitlecharsmax(szTitle), "Ice Grenade \r[Freeze] \d[%d]"get_pcvar_num(g_Cvar[CVAR_ICE_PRICE])),
    
menu_additem(pMenuszTitle"4");      

    
formatex(szTitlecharsmax(szTitle), "AWP \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_AWP_PRICE])),
    
menu_additem(pMenuszTitle"5");

    
formatex(szTitlecharsmax(szTitle), "TEC TEC \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE])),
    
menu_additem(pMenuszTitle"6");

    
formatex(szTitlecharsmax(szTitle), "Scout \r[Weapon] \d[%d]"get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE])),
    
menu_additem(pMenuszTitle"7");

    
formatex(szTitlecharsmax(szTitle), "KIT Grenade \r[Grenade] \r[%d]"get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE])),
    
menu_additem(pMenuszTitle"8");

    
formatex(szTitlecharsmax(szTitle), "Escudo \r[Escudo] \r[%d]"get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE])),
    
menu_additem(pMenuszTitle"9");


    
menu_setprop(pMenuMPROP_EXITMEXIT_ALL)
    
menu_setprop(pMenuMPROP_BACKNAME"Voltar")
    
menu_setprop(pMenuMPROP_NEXTNAME"Proximo")
    
menu_setprop(pMenuMPROP_EXITNAME"Sair")

    
menu_display(idpMenu0)

    return 
PLUGIN_HANDLED
}

public 
xShopMenuHandle(idpMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(pMenu)
        return 
PLUGIN_HANDLED
    
}

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(pMenuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    
pCash[id] = csr_get_user_points(id)

    new 
pKey str_to_num(szData)
    {
        switch(
pKey)
        {
            case 
0:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                {
                    if(
pDamage[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE])))
                    
g_iCurrentPower[id] = DOUBLE_DAMAGE
                    set_task
(30.0"reset_user_power"id TASK_RESET_POWER)
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Dobro Dano"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_DAMAGE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
1:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                {
                    if(
pInvisible[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    if(
is_user_alive(id))
                    {
                        

                    }

                    
g_iCurrentPower[id] = INVISIBILITY

                    csr_set_user_points
(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_INVISI_PRICE])))
                    
fPtime[id] = halflife_time() + 20
                    set_task
(20.0"make_player_visible"id INV_TASK)
                    
pInvisible[id] = true
                    client_print_color
(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Invisibilidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_INVISI_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)

                    return 
PLUGIN_HANDLED
                
}
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
2:
            { 
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                {
                    if(
pHealthRegen[id] || task_exists(id+HP_REGEN))
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
g_iCurrentPower[id] = HP_REGEN

                    csr_set_user_points
(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
pHealthRegen[id] = true 
                    set_task
(0.25"player_AdrenalineDrain"id+HP_REGEN, .flags="b")
                    
set_task(25.0"remove_hp_regen_power"id 231312)
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Regenerar HP"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
3:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SPEED_PRICE]))
                {
                    if(
pSpeed[id])
                    {
                        
client_print_color(idprint_team_default"%s ^3Não é possível comprar esse item novamente enquanto ele estiver em uso"PREFIX_CHAT)
                        return 
PLUGIN_HANDLED
                    
}

                    
g_iCurrentPower[id] = SPEED


                    csr_set_user_points
(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE])))
                    
player_updateSpeed(id)
                    
pSpeed[id] = true 
                    client_print_color
(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Velocidade"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_REGLIFE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
4:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_ICE_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_ICE_PRICE])))
                    
give_item(id"weapon_smokegrenade")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Granada De Gelo"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }

            }
            case 
5:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_AWP_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_AWP_PRICE])))
                    
give_item(id"weapon_awp")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: AWP"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d CASH"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                } 

            }
            case 
6:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE])))
                    
give_item(id"weapon_g3sg1")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Tec Tec"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_TECTEC_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
7:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE])))
                    
give_item(id"weapon_scout")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Scout"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_SCOUT_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
8:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE])))
                    
give_item(id"weapon_hegranade")
                    
give_item(id"weapon_smokegrenade")
                    
give_item(id"weapon_flashbang")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Kit Granada"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_GRENADE_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)

                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
            case 
9:
            {
                if(
pCash[id] >= get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE]))
                {
                    
csr_set_user_points(idclamp(pCash[id] - get_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE])))
                    
give_item(id"weapon_shield")
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item Extra Obtido"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Item: Escudo"PREFIX_CHAT)
                    
client_print_color(idprint_team_default"%s ^1Preço: %d Cash"PREFIX_CHATget_pcvar_num(g_Cvar[CVAR_SHIELD_PRICE]))
                    
client_print_color(idprint_team_default"%s ^4------ ^1------ ^4------ ^3------"PREFIX_CHAT)             
                }
                else 
                {
                    
client_print_color(idprint_team_default"%s ^1Voce nao tem ^4cash ^3suficiente"PREFIX_CHAT)
                }
            }
        }
    }
    return 
PLUGIN_HANDLED
}

public 
make_player_visible(id)
{
    
id -= INV_TASK

    set_user_rendering
(idkRenderFxNone000kRenderTransAlpha0)
    
g_iCurrentPower[id] = NO_POWER_SELECTED
}


public 
AddToFullPack(eseenthostflagsplayerset)
{
    if(!
player)
    {
        return
    }
    
    if(
pInvisible[ent])
    {
        
set_user_rendering(entkRenderFxNone000kRenderTransAlpha0)
        
client_print(entprint_center"Invisibilidade: %0.1f segundo%s"fPtime[ent] - halflife_time(), (fPtime[ent] - halflife_time() > 1.9 "s" ""))
        if(
halflife_time() >= fPtime[ent] - 0.1)
        {
            
client_print_color(entprint_team_default"%s ^1Sua ^4invisibilidade ^1acabou"PREFIX_CHAT)
            
pInvisible[ent] = false
        
}
    }
}


public 
player_AdrenalineDrain(taskid)
{
    new 
id taskid HP_REGEN
    
new iHealth pev(idpev_health)
    
    if(
is_user_alive(id) && pev_valid(id))
    {
        if(
iHealth 150)
        {
            
set_pev(idpev_healthiHealth 1.0)
        }
        else
        {
            
remove_task(id+HP_REGEN)
            
client_print_color(idprint_team_default"%s ^1Sua ^4Reg Vida ^1foi concluída")
            
pHealthRegen[id] = false
        
}
    }
}

public 
remove_hp_regen_power(id)
{
    
g_iCurrentPower[id] = NO_POWER_SELECTED
    
if(task_exists(id HP_REGEN))
    {
        
remove_task(id HP_REGEN)
    }
}

player_updateSpeed(id)
{

    
g_iCurrentPower[id] = SPEED
    
// Float
    
new Float:fSpeed 1.0
    
    fSpeed 
*= SPEED_ADRENALINE;

    
// SPED
    
set_user_maxspeed(idg_fWeaponSpeed[id] * fSpeed)

}

public 
reset_user_power(id)
{
    
id -= TASK_RESET_POWER

    g_iCurrentPower
[id] = NO_POWER_SELECTED


Last edited by yagami; 07-24-2023 at 18:35.
yagami is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-25-2023 , 19:32   Re: event_playerkiller
Reply With Quote #8

Remember, you're asking here for help on how to do it. If you're really willing to put in the time and effort, follow these steps:

1: Register Ham_Killed as told before, check this post as example on how to do it: https://forums.alliedmods.net/showpo...16&postcount=5
2: Set skill/bool to false when player dies.

I don't know how to explain it in another way than this, this should help you more than enough.
If you don't want to do this yourself, you should post it in suggestions/requests
__________________

Last edited by Napoleon_be; 07-25-2023 at 19:32.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 09:48.


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