Raised This Month: $ Target: $400
 0% 

Grenade Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mifuntm
Senior Member
Join Date: Feb 2008
Location: in space...
Old 01-28-2009 , 06:25   Grenade Kill
Reply With Quote #1

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

#include <amxmodx>
#include <amxmisc>
 
new g_Enable
 
public plugin_init()
{
        register_plugin("Grenade Kill", "1.0", "hleV")
 
        g_Enable = register_cvar("gk_enable", "1")
 
        register_event("DeathMsg", "playerDeath", "a", "1>0")
}
 
public playerDeath()
{
        new killer = read_data(1)
        new victim = read_data(2)
        new weapon[8]
        read_data(4, weapon, 7)
 
        if (get_pcvar_num(g_Enable) && killer != victim && equal(weapon, "grenade"))
                client_cmd(0, "spk misc/grenadekill")
}
 
public plugin_precache()
        precache_sound("misc/grenadekill.wav")


This plugin work fine but if someone get killed by HeGrenade sound "grenadekill.wav" its playing for all players connected to the server.
Please help, and change code to playback sound only for victim.
example: if i get killed by HeGrenade plugin play this sound but only for me.
Thanks.
Mifuntm is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-28-2009 , 06:32   Re: Grenade Kill
Reply With Quote #2

Hey,

PHP Code:
#include <amxmodx>
#include <amxmisc>
 
new g_Enable
 
public plugin_init()
{
        
register_plugin("Grenade Kill""1.0""hleV")
 
        
g_Enable register_cvar("gk_enable""1")
 
        
register_event("DeathMsg""playerDeath""a""1>0")
}
 
public 
playerDeath()
{
        new 
killer read_data(1)
        new 
victim read_data(2)
        new 
weapon[8]
        
read_data(4weapon7)
 
        if (
get_pcvar_num(g_Enable) && killer != victim && equal(weapon"grenade"))
                
client_cmd(victim"spk misc/grenadekill")
}
 
public 
plugin_precache()
        
precache_sound("misc/grenadekill.wav"

Last edited by One; 01-28-2009 at 09:55.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-28-2009 , 09:51   Re: Grenade Kill
Reply With Quote #3

Quote:
Originally Posted by One View Post
Hey,

PHP Code:
#include <amxmodx>
#include <amxmisc>
 
new g_Enable
 
public plugin_init()
{
        
register_plugin("Grenade Kill""1.0""hleV")
 
        
g_Enable register_cvar("gk_enable""1")
 
        
register_event("DeathMsg""playerDeath""a""1>0")
}
 
public 
playerDeath()
{
        new 
killer read_data(1)
        new 
victim read_data(2)
        new 
weapon[8]
        
read_data(4weapon7)
 
        if (
get_pcvar_num(g_Enable) && killer != victim && equal(weapon"grenade"))
                
client_cmd(0"spk misc/grenadekill")
}
 
public 
plugin_precache()
        
client_cmd(0"speak ^"misc/grenadekill.wav^" "
This is completely wrong.
You must precache the sound for the plugin that is going to use it.
You can't execute client commands on plugin_precache, as no players are connected when precaching.

All he needs to do is what ianglowz said:
Code:
client_cmd(victim, "spk misc/grenadekill.wav");
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 01-28-2009 at 09:59.
Dores is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-28-2009 , 09:54   Re: Grenade Kill
Reply With Quote #4

Hey,

oh damn.thats right. idk why i changed precache :-O sry ma bad.ill edit ma post now :-D & ty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-28-2009 , 10:00   Re: Grenade Kill
Reply With Quote #5

Also, it's spk, not speak, and you don't need to put quotes(") around the sound.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-28-2009 , 10:54   Re: Grenade Kill
Reply With Quote #6

Quote:
Originally Posted by Dores View Post
Also, it's spk, not speak, and you don't need to put quotes(") around the sound.
Hey,

u mean me?

PHP Code:
#include <amxmodx>
#include <amxmisc>
 
new g_Enable
 
public plugin_init()
{
        
register_plugin("Grenade Kill""1.0""hleV")
 
        
g_Enable register_cvar("gk_enable""1")
 
        
register_event("DeathMsg""playerDeath""a""1>0")
}
 
public 
playerDeath()
{
        new 
killer read_data(1)
        new 
victim read_data(2)
        new 
weapon[8]
        
read_data(4weapon7)
 
        if (
get_pcvar_num(g_Enable) && killer != victim && equal(weapon"grenade"))
                
client_cmd(victim"spk misc/grenadekill")
}
 
public 
plugin_precache()
        
precache_sound("misc/grenadekill.wav"
I think its now right.. i edited ma first post
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 01-28-2009 , 10:56   Re: Grenade Kill
Reply With Quote #7

Quote:
Originally Posted by Dores View Post
Also, it's spk, not speak, and you don't need to put quotes(") around the sound.
Yes, you should. It helps.
BOYSplayCS is offline
ianglowz
Senior Member
Join Date: Nov 2008
Old 01-28-2009 , 06:34   Re: Grenade Kill
Reply With Quote #8

Change this:

PHP Code:
client_cmd(0"spk misc/grenadekill"
To

PHP Code:
client_cmd(victim"spk misc/grenadekill"
__________________
~ +karma to me and leave your name. ~
~ If you -karma to me,please leave your name so I know you are pro scripter. ~
~ Helping anytime ~


ianglowz is offline
Mifuntm
Senior Member
Join Date: Feb 2008
Location: in space...
Old 01-28-2009 , 10:45   Re: Grenade Kill
Reply With Quote #9

Thanks ianglowz work fine for me

Last edited by Mifuntm; 01-28-2009 at 12:22.
Mifuntm 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 01:44.


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