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

Healthkit on dead body


Post New Thread Reply   
 
Thread Tools Display Modes
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 03-18-2018 , 07:36   Re: Healthkit on dead body
Reply With Quote #81

Hi.Tell me what value to put something to the first aid kit from a player with his murder,had NOT for HIM,and in the direction of somewhere?Toist ,something was flying at loss..

Thank You Very Much.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>

new const szModelKit[]="models/medkit_wc.mdl"
new const gMedKitClassname[]="kit_ent"
new gToggleKitEnable,gToggleGlowShow,gGMsgFade,gToggleFadeEnable
new gToggleDelRespawn,gKitPickMode,gKitHPCvar,gLimitHPCvar,gGMsgItemPickup

public plugin_init()
{
    
register_plugin("Death Medkit Drop","4.2","tuty; 731; Midnight Kid")
    
register_event("DeathMsg","dropkit","a")
    
register_logevent("logevent",2,"1=Round_Start")
    
register_touch("kit_ent","player","forward_FM_Touch")
    
gToggleKitEnable=register_cvar("kit_enable","1")
    
gToggleGlowShow=register_cvar("kit_glow","0")
    
gToggleFadeEnable=register_cvar("kit_fade","1")
    
gToggleDelRespawn=register_cvar("kit_del","1")
    
gKitPickMode=register_cvar("kit_pick","0")
    
gKitHPCvar=register_cvar("kit_hp","15")
    
gLimitHPCvar=register_cvar("kit_limit_hp","200")
    
gGMsgFade=get_user_msgid("ScreenFade")
}

public 
plugin_precache()
{
    
precache_model(szModelKit)
}

public 
dropkit()
{
    if(!
get_pcvar_num(gToggleKitEnable))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
gVic=read_data(2)
    static 
Float:flOrigin[3]
    
pev(gVic,pev_origin,flOrigin)
    new 
ent=engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
    
flOrigin[2]-=36
    engfunc
(EngFunc_SetOrigin,ent,flOrigin)
    if(!
pev_valid(ent))
    {
        return 
PLUGIN_HANDLED
    
}
    
set_pev(ent,pev_classname,gMedKitClassname)
        
set_pev(entpev_sequence1)
        
set_pev(entpev_framerate1.0)
    
engfunc(EngFunc_SetModel,ent,szModelKit)
    
dllfunc(DLLFunc_Spawn,ent)
    
set_pev(ent,pev_solid,SOLID_TRIGGER)
    
set_pev(ent,pev_movetype,MOVETYPE_NONE)
    
engfunc(EngFunc_SetSize,ent,Float:{-23.160000,-13.660000,-0.050000},Float:{11.470000,12.780000,6.720000})
    
engfunc(EngFunc_DropToFloor,ent)
    new 
KitPick=get_pcvar_num(gKitPickMode)
    new 
Vic=get_user_team(gVic)
    if(
get_pcvar_num(gToggleGlowShow))
    {
        switch(
KitPick)
        {
            case 
0:
            {
                
fm_set_rendering(ent,kRenderFxGlowShell,255,255,255,kRenderFxNone,27)
            }
            case 
1:
            {
                switch(
Vic)
                {
                    case 
1:
                    {
                        
fm_set_rendering(ent,kRenderFxGlowShell,0,0,255,kRenderFxNone,27)
                        
entity_set_int(ent,EV_INT_team,1)
                    }
                    case 
2:
                    {
                        
fm_set_rendering(ent,kRenderFxGlowShell,255,0,0,kRenderFxNone,27)
                        
entity_set_int(ent,EV_INT_team,2)
                    }
                }
            }
            case 
2:
            {
                switch(
Vic)
                {
                    case 
1:
                    {
                        
fm_set_rendering(ent,kRenderFxGlowShell,255,0,0,kRenderFxNone,27)
                        
entity_set_int(ent,EV_INT_team,1)
                    }
                    case 
2:
                    {
                        
fm_set_rendering(ent,kRenderFxGlowShell,0,0,255,kRenderFxNone,27)
                        
entity_set_int(ent,EV_INT_team,2)
                    }
                }
            }
        }
    }
    return 
PLUGIN_HANDLED
}

public 
forward_FM_Touch(ent,id)
{
    if(!
pev_valid(ent)||!get_pcvar_num(gToggleKitEnable))
    {
        return 
FMRES_IGNORED
    
}
    new 
KitPick=get_pcvar_num(gKitPickMode)
    new 
own_team=get_user_team(id)
    new 
find_team=entity_get_int(ent,EV_INT_team)
    switch(
KitPick)
    {
        case 
1:
        {
            if(
find_team==own_team)
            {
                return 
FMRES_IGNORED
            
}
        }
        case 
2:
        {
            if(
find_team!=own_team)
            {
                return 
FMRES_IGNORED
            
}
        }
    }
    new 
szClassname[32]
    
pev(ent,pev_classname,szClassname,charsmax(szClassname))
    if(!
equal(szClassname,gMedKitClassname))
    {
        return 
FMRES_IGNORED
    
}
    new 
userHP=get_user_health(id)
    new 
cvarHP=get_pcvar_num(gKitHPCvar)
    new 
maxHP=get_pcvar_num(gLimitHPCvar)
    if(
userHP>=maxHP)
    {
        return 
FMRES_IGNORED
    
}
    if(
maxHP-userHP<cvarHP&&maxHP-userHP>0)
    {
        
fm_set_user_health(id,maxHP)
    }
    else
    {
        
fm_set_user_health(id,userHP+cvarHP)
    }
    
client_cmd(id"spk sound/items/smallmedkit1.wav")
    if(
get_pcvar_num(gToggleFadeEnable))
    {
        if(
KitPick==0)
        {
            
message_begin(MSG_ONE_UNRELIABLE,gGMsgFade,_,id)
            
write_short(1<<10)
            
write_short(1<<10)
            
write_short(0x0000)
            
write_byte(200)
            
write_byte(150)
            
write_byte(0)
            
write_byte(75)
            
message_end()
        }
        if(
KitPick==1||KitPick==2)
        {
            switch(
own_team)
            {
                case 
1:
                {
                    
message_begin(MSG_ONE_UNRELIABLE,gGMsgFade,_,id)
                    
write_short(1<<10)
                    
write_short(1<<10)
                    
write_short(0x0000)
                    
write_byte(255)
                    
write_byte(150)
                    
write_byte(0)
                    
write_byte(75)
                    
message_end()
                }
                case 
2:
                {
                    
message_begin(MSG_ONE_UNRELIABLE,gGMsgFade,_,id)
                    
write_short(1<<10)
                    
write_short(1<<10)
                    
write_short(0x0000)
                    
write_byte(255)
                    
write_byte(150)
                    
write_byte(0)
                    
write_byte(75)
                    
message_end()
                }
            }
        }
    }
    
engfunc(EngFunc_RemoveEntity,ent)
    if(
KitPick==0)
    {
        return 
PLUGIN_CONTINUE
    
}
    return 
FMRES_IGNORED
}

public 
logevent()
{
    if(
get_pcvar_num(gToggleDelRespawn))
    {
        new 
entity=FM_NULLENT
        
while((entity=fm_find_ent_by_class(entity,gMedKitClassname)))
        {
            
engfunc(EngFunc_RemoveEntity,entity)
        }
    }
}

stock UTIL_Send_PickMess(const id,const szItemName[])
{
    
message_begin(MSG_ONE_UNRELIABLE,gGMsgItemPickup,_,id)
    
write_string(szItemName)
    
message_end()

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Midnight Kid
Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 03-19-2018 , 03:00   Re: Healthkit on dead body
Reply With Quote #82

Maybe this

PHP Code:
set_pev(ent,pev_movetype,MOVETYPE_STEP
or

PHP Code:
set_pev(ent,pev_movetype,MOVETYPE_PUSHSTEP
However, there's a risk that the medkit will fail under the textures.
By the way, I'd look at the alternative to replace the standard DeathMSG in support of #include hamsandwich and Z-Bot Spawn Bitparser ('cause with certain changes, DeathMSG will crush the server). But this requires any time for realize this yet the only damned bug.

Last edited by Midnight Kid; 03-19-2018 at 04:52.
Midnight Kid is offline
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 03-19-2018 , 06:18   Re: Healthkit on dead body
Reply With Quote #83

Quote:
Originally Posted by Midnight Kid View Post

However, there's a risk that the medkit will fail under the textures.
By the way, I'd look at the alternative to replace the standard DeathMSG in support of #include hamsandwich and Z-Bot Spawn Bitparser ('cause with certain changes, DeathMSG will crush the server). But this requires any time for realize this yet the only damned bug.
Thank you for the answer

With the standard from tuty such bugs were ( in logs mistakes and fall immediately )

If Your Council, this will be too - we can safely abandon such a loss

I'll write about the result.

And for Your code - thank you very much !
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 03-19-2018 , 06:31   Re: Healthkit on dead body
Reply With Quote #84

This value does not work
PHP Code:
set_pev(ent,pev_movetype,MOVETYPE_STEP
set_pev(ent,pev_movetype,MOVETYPE_PUSHSTEP
Probably need something like this

PHP Code:
set_pev(newentpev_nextthinkget_gametime() + 0.01)
if(!
is_user_alive(id)) { 
velo[0] = random_float(1.0,150.0
velo[1] = random_float(1.0,150.0
velo[2] = random_float(1.0,150.0

else 
velo[2] += 100 
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Midnight Kid
Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 03-22-2018 , 06:45   Re: Healthkit on dead body
Reply With Quote #85

MayroN, I think so, plugin Players Drop Money should help, 'cause it has similar structure.

Last edited by Midnight Kid; 03-22-2018 at 06:51.
Midnight Kid is offline
Midnight Kid
Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 10-13-2019 , 14:45   Re: Healthkit on dead body
Reply With Quote #86

UNOFFICIAL RELEASE UPDATE.
VERSION 5.0.


Changes:
- Created 4 types of medkits (low, medium, high, extra) and their drop probability.
- Added probability of medkit glow colours.
- Created 4 modes of medkit drop and random of these modes.
- Added lifetime and animation for step drop (by MayroN).
- Fixed small bugs.

New cvars added and fixed:

kit_pick (0-4):
0 - random selection of 4 modes in every round. The chat message informs player about selected mode.
1 - medkits can be picked by opposite team only (red / blue medkit glow + team colour fadescreen)
2 - medkits can be picked by partner team only (red / blue medkit glow + team colour fadescreen)
3 - medkits can be picked by anyone (white medkit glow + white colour fadescreen)
4 - random pickup rules for every medkit (glow colour shows what team can take the medkit: red for T, blue for CT or white for both teams)

kit_prob (0-1): turn on / off probability of medkits in 4th kitpick mode.
kit_prob_pc a b c: nums of that probability in percents (a - for T; b - for both teams; c - for CT).

kit_res (0-1): turn on / off 4 medkit types for healing HP. If off-mode activated, there's only 1 type of medkit.
kit_res_pc a b c d: nums of that probability in percents:
1st type - low (healing - 0,01-25,00 % HP; probability - a %);
2nd - medium (healing - 25,01-50,00 % HP; probability - b %);
3rd - high (healing - 50,01-100,00 % HP; probability - c %);
4th - extra (healing - 100 % HP; probability - d %).
kit_hp a b: min (a) and max (b) healing HP in percents for kit_res 0 (off-mode).
kit_msg (0-1): turn on / off HUD-message of healing information.
kit_tc (0-1): turn on / off team glow colour for fadescreen and HUD-message in 3rd and 4th medkit mode when player take medkit with white glow.

kit_lifetime: timelimit of medkit staying on the map (in seconds). For value 0 the medkit lies for the specified deadline by the kit_del_resp.
kit_drop_step: radius of medkit drop.

Replacing cvars:
kit_del → kit_del_resp.

Thanks MayroN, sites amx-x.ru, c-s.net.ua for the great help in finding models, bug fixing and optimizing code.
Attached Files
File Type: sma Get Plugin or Get Source (death_medkit_drop.sma - 471 views - 9.9 KB)
File Type: 7z cstrike.7z (508.6 KB, 253 views)

Last edited by Midnight Kid; 08-20-2020 at 02:59.
Midnight Kid is offline
Midnight Kid
Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 06-08-2020 , 16:14   Re: Healthkit on dead body
Reply With Quote #87

Version 5.1.
Added support AMXX 1.8.3+ and cosmetic corrected code (SMA-script in archive rewritten special for AMXX 1.9+).
Attached Files
File Type: sma Get Plugin or Get Source (death_medkit_drop.sma - 298 views - 9.7 KB)
File Type: 7z death_medkit_drop.7z (491.9 KB, 175 views)
Midnight Kid is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 11-16-2021 , 07:35   Re: Healthkit on dead body
Reply With Quote #88

Quote:
Originally Posted by Midnight Kid View Post
Version 5.1.
Added support AMXX 1.8.3+ and cosmetic corrected code (SMA-script in archive rewritten special for AMXX 1.9+).
The two sma files are different.
1. One sma only
2. sma in archive

I have amx 1.10 and i must to use sma in archive right ?

Last edited by Siska1; 11-16-2021 at 09:15.
Siska1 is offline
Send a message via Skype™ to Siska1
Midnight Kid
Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 11-17-2021 , 16:23   Re: Healthkit on dead body
Reply With Quote #89

Quote:
Originally Posted by Siska1 View Post
I have amx 1.10 and i must to use sma in archive right ?
Correct.
Midnight Kid is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 12-07-2021 , 10:24   Re: Healthkit on dead body
Reply With Quote #90

Quote:
Originally Posted by Midnight Kid View Post
Correct.
Can i ask you to remove the glow effect completely from the plugin ?
I don't know exactly how to remove it...
Siska1 is offline
Send a message via Skype™ to Siska1
Reply


Thread Tools
Display Modes

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 20:25.


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