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

[HELP] edit plugin Medkit Drop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-18-2020 , 10:05   [HELP] edit plugin Medkit Drop
Reply With Quote #1

I want this plugin to give the player the ak47 and ammo instead of health

Code:
give health - To - give ak47+ammo
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <fakemeta>
#include <xs>
#include <cs_player_models_api>

#define PLUGIN "Medkit Drop"
#define VERSION "1.0"
#define AUTHOR "nobody"

new const g_medkit_name[] = "Medkit";

new 
g_medkitsHamHook:FW_TRACEATTACK_FUNC_HC_POSTHamHook:FW_KILLED_FUNC_HC_POSTmedkit_gibs_mdl_index;

new 
MEDKIT_BREAK_SND[64] = "debris/metal5.wav"MEDKIT_W_MDL[64] = "models/w_medkit.mdl"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /seet""drop_medkit")
}

public 
plugin_precache()
{
    
precache_model(MEDKIT_W_MDL)
    
precache_sound(MEDKIT_BREAK_SND)
    
precache_sound("items/medshot4.wav")
    
precache_sound("items/medshotno1.wav")
    
precache_sound("items/medcharge4.wav")
}

public 
drop_medkit(id)
{
    new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_healthcharger"));
    
    if(!
ent) return;
    
    new 
Float:fOrigin[3], Float:fOrigin2[3], Float:fVelocity[3];
    
velocity_by_aim(id250fVelocity)
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfOrigin2)
    
xs_vec_add(fOriginfOrigin2fOrigin)
    
    
engfunc(EngFunc_SetOriginentfOrigin);
    
engfunc(EngFunc_SetModelentMEDKIT_W_MDL);
    
//set_pev(ent, pev_spawnflags, SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);
    
engfunc(EngFunc_SetSizeentFloat:{-5.0,-5.0,-5.0}, Float:{5.0,5.0,5.0});
    
set_pev(entpev_velocityfVelocity);
    
fVelocity[0] = 0.0fVelocity[2] = 0.0fVelocity[1] = !random(1) ? -360.0:360.0;
    
set_pev(entpev_avelocityfVelocity);
    
set_pev(entpev_friction1.4);
    
set_pev(entpev_globalnameg_medkit_name);
    
set_pev(entpev_ownerid);
    
set_pev(entpev_takedamageDAMAGE_YES);
    
set_pev(entpev_health100.0);
    
set_pev(entpev_dmg_take25.0)
    
set_pev(entpev_solidSOLID_BBOX);
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE);
    
    if(
g_medkits == 1)
    {
        if(!
FW_TRACEATTACK_FUNC_HC_POST)
        {
            
DisableHamForward(FW_TRACEATTACK_FUNC_HC_POST RegisterHam(Ham_TraceAttack"func_healthcharger""fw_tattack_func_hc_post"1));
            
DisableHamForward(FW_KILLED_FUNC_HC_POST RegisterHam(Ham_Killed"func_healthcharger""fw_killed_func_hg_pre"));
        }
        
        
EnableHamForward(FW_TRACEATTACK_FUNC_HC_POST);
        
EnableHamForward(FW_KILLED_FUNC_HC_POST);
    }
    
    
set_task(1.2"reset_velocity"ent);
}

public 
fw_killed_func_hg_pre(victimattackershouldgib)
{
    new 
sTargetname[16];
    
pev(victimpev_globalnamesTargetnamecharsmax(sTargetname))
    
    if(!
equal(sTargetnameg_medkit_name)) return HAM_IGNORED;
    
    new 
Float:fOrigin[3];
    
pev(victimpev_originfOrigin)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BREAKMODEL);
    
engfunc(EngFunc_WriteCoordfOrigin[0]);
    
engfunc(EngFunc_WriteCoordfOrigin[1]);
    
engfunc(EngFunc_WriteCoordfOrigin[2] + 25.0);
    
write_coord(16); // size x 
    
write_coord(16); // size y 
    
write_coord(16); // size z 
    
write_coord(random_num(-50,50)); // velocity x 
    
write_coord(random_num(-50,50)); // velocity y 
    
write_coord(25); // velocity z 
    
write_byte(10); // random velocity 
    
write_short(medkit_gibs_mdl_index); // model index that you want to break 
    
write_byte(10); // count 
    
write_byte(25); // life 
    
write_byte(0x02); // flags
    
message_end();
    
    
emit_sound(victimCHAN_BODYMEDKIT_BREAK_SNDVOL_NORMATTN_NORM0PITCH_HIGH);

    
set_pev(victimpev_flagsFL_KILLME);
    
dllfunc(DLLFunc_Thinkvictim);
    
    return 
HAM_IGNORED;
}

public 
fw_tattack_func_hc_post(entattackerFloat:damageFloat:direction[3], traceresultdamagebits)
{
    static 
sTargetname[16];
    
pev(entpev_globalnamesTargetnamecharsmax(sTargetname))
    
    if(!
equal(sTargetnameg_medkit_name)) return HAM_IGNORED;
    
    if(
pev(entpev_takedamage) == DAMAGE_YES)
    {
        static 
Float:fEnd[3];
        
get_tr2(traceresultTR_vecEndPosfEnd)
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_GUNSHOT);
        
engfunc(EngFunc_WriteCoordfEnd[0]);
        
engfunc(EngFunc_WriteCoordfEnd[1]);
        
engfunc(EngFunc_WriteCoordfEnd[2]);
        
message_end();
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_SPARKS);
        
engfunc(EngFunc_WriteCoordfEnd[0]);
        
engfunc(EngFunc_WriteCoordfEnd[1]);
        
engfunc(EngFunc_WriteCoordfEnd[2]);
        
message_end();
    }
    
    return 
HAM_IGNORED;
}

public 
reset_velocity(ent)
{
    if(
pev_valid(ent))
    {
        
set_pev(entpev_velocityFloat:{0.0,0.0,0.0});
        
set_pev(entpev_avelocityFloat:{0.0,0.0,0.0});
        
set_pev(entpev_owner33);
    }


Last edited by alferd; 06-18-2020 at 15:59.
alferd is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-18-2020 , 14:37   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #2

Code:
#define AUTHOR "AlferD"

If you're able to write the entire thing as the plugin's author name says, you're able to do a simple thing like giving a weapon to a player.
__________________

Last edited by OciXCrom; 06-18-2020 at 14:37.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-18-2020 , 15:58   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Code:
#define AUTHOR "AlferD"

If you're able to write the entire thing as the plugin's author name says, you're able to do a simple thing like giving a weapon to a player.
I just collected the codes

-----------------
Code:
func_healthcharger
I am not familiar with all the codes :/

Last edited by alferd; 06-18-2020 at 16:01.
alferd is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-19-2020 , 05:52   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #4

oh my familiar piece of code.

author nobody like i never wrote anything.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-20-2020 , 02:37   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #5

I don't think I can get help from you anymore

@Natsheh
Forgive me for my mistake

Last edited by alferd; 06-20-2020 at 02:37.
alferd is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-20-2020 , 04:27   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #6

That's not the point what you have literally asked for has nothing to do with the piece of code that you provided.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-21-2020 , 08:56   Re: [HELP] edit plugin Medkit Drop
Reply With Quote #7

Just hook func_healthcharger touch (Ham_Touch), give the ak47 and ammo (give_item , cs_set_user_bpammo) and block the call (return HAM_SUPERCEDE).
__________________








CrazY. 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 13:22.


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