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

Hs and knife kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ssproxima
Senior Member
Join Date: Jan 2015
Old 04-22-2015 , 00:09   Hs and knife kill
Reply With Quote #1

Hello,
I want this plugin to be modified to if head shot 2 frags and if knife kill + 25 hp what it is doing is giving 2 frags and +25hp even if knife kill or headshot, please modify it
PHP Code:
#include <amxmod>
#include <fun>

public hs_kill(){
   if(!
get_cvar_num("amx_hsreward")) return PLUGIN_HANDLED 
   
new killer read_data(1)
   if (
killer == 0)  
      return 
PLUGIN_CONTINUE
       
   set_user_frags
(killerget_user_frags(killer)+1)
   return 
PLUGIN_CONTINUE
}

public 
knife_kill(){
   if(!
get_cvar_num("amx_knifereward")) return PLUGIN_HANDLED 
   
new killer read_data(1)
   if (
killer == 0
      return 
PLUGIN_CONTINUE
    set_user_health
(killerget_user_health(killer)+25)
   return 
PLUGIN_CONTINUE
}

public 
plugin_init() {
   
register_plugin("Tuff kill Rewards","0.3","mongo")
   
register_event("DeathMsg","hs_kill","ade","3=1","5=0")
   
register_event("DeathMsg","knife_kill","ade","3=1","5=0")
   
register_cvar("amx_hsreward""1")
   
register_cvar("amx_knifereward""1")
   return 
PLUGIN_CONTINUE

ssproxima is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-22-2015 , 04:29   Re: Hs and knife kill
Reply With Quote #2

hope this can help you
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "Kill Reward"
#define VERSION "1.0"
#define AUTHOR "S.M"

new cvar_knifekillcvar_headshot

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
cvar_knifekill register_cvar("knife_kill""1")
    
cvar_headshot register_cvar("hs_kill""1")
    
register_event("DeathMsg""DeathMsg""a")
}
public 
plugin_precache()
{
    
precache_sound("misc/sound.wav")
}
public 
DeathMsg()
{
    new 
attacker read_data(1)
    new 
headshot read_data(3)
    new 
wpn[32], wpnid
    read_data
(4wpncharsmax(wpn))
    
formatex(wpncharsmax(wpn), "weapon_%s"wpn)
    
wpnid get_weaponid(wpn)
    if(
is_user_alive(attacker) && headshot && get_pcvar_num(cvar_headshot))
        
set_user_frags(attackerget_user_frags(attacker) + 1)
    if(
is_user_alive(attacker) && wpnid == CSW_KNIFE && get_pcvar_num(cvar_knifekill))
    {
        
set_user_health(attackerget_user_health(attacker) + 25)
        
client_cmd(0"spk sound.wav")
    }

__________________

Last edited by Shiina.Mashiro; 04-23-2015 at 05:49. Reason: edit code
Shiina.Mashiro is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 04-22-2015 , 06:14   Re: Hs and knife kill
Reply With Quote #3

Shiina, your code is not correct. Have you tried to compile it?

Last edited by zmd94; 04-22-2015 at 06:15.
zmd94 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 04-22-2015 , 06:35   Re: Hs and knife kill
Reply With Quote #4

PHP Code:
to get cvar value 
native get_pcvar_num
(pcvar); 
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 04-22-2015 , 07:44   Re: Hs and knife kill
Reply With Quote #5

Thank you shiina the plugin is working fine but can you do a modification that if any one kill with a knife a sound is played mp3/wav format
ssproxima is offline
Obada
Senior Member
Join Date: Dec 2014
Location: Abu Dhabi
Old 04-22-2015 , 08:47   Re: Hs and knife kill
Reply With Quote #6

PHP Code:
if(is_user_alive(attacker) && wpnid == CSW_KNIFE && cvar_knifekill)
        
set_user_health(attackerget_user_health(attacker) + 25)

-->

PHP Code:
if(is_user_alive(attacker) && wpnid == CSW_KNIFE && cvar_knifekill)
        
set_user_health(attackerget_user_health(attacker) + 25)
        
client_cmd(0"spk .wav"// Change to your sound file name.


Last edited by Obada; 04-23-2015 at 06:23.
Obada is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-22-2015 , 10:21   Re: Hs and knife kill
Reply With Quote #7

Quote:
Originally Posted by zmd94 View Post
Shiina, your code is not correct. Have you tried to compile it?
yes, compiled fine to me
__________________
Shiina.Mashiro is offline
ssproxima
Senior Member
Join Date: Jan 2015
Old 04-22-2015 , 12:08   Re: Hs and knife kill
Reply With Quote #8

following errors occurs while compiling after putting client_cmd(0, spk.wav)

killrew.sma(32) : warning 217: loose indentation
killrew.sma(32) : error 017: undefined symbol "spk"

1 Error.
Could not locate output file killrew.amx (compile failed).


ERROR: Your plugin failed to compile, see above.
ssproxima is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-23-2015 , 00:36   Re: Hs and knife kill
Reply With Quote #9

Quote:
Originally Posted by ssproxima View Post
following errors occurs while compiling after putting client_cmd(0, spk.wav)

killrew.sma(32) : warning 217: loose indentation
killrew.sma(32) : error 017: undefined symbol "spk"

1 Error.
Could not locate output file killrew.amx (compile failed).


ERROR: Your plugin failed to compile, see above.
It's Obada's code which caused the complier fails.
just change to
PHP Code:
if(is_user_alive(attacker) && wpnid == CSW_KNIFE && cvar_knifekill
{
        
set_user_health(attackerget_user_health(attacker) + 25
        
client_cmd(0"spk sound.wav")

</span></span>
__________________
Shiina.Mashiro is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 04-23-2015 , 05:14   Re: Hs and knife kill
Reply With Quote #10

i think zmd94 talking about this
Sm this is not the way to assign cvar
if(is_user_alive(attacker) && headshot && cvar_headshot)
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
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 07:30.


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