Raised This Month: $2 Target: $400
 0% 

Knife Kill Bonus Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allroundernaman
Member
Join Date: May 2020
Location: India
Old 06-27-2020 , 04:00   Knife Kill Bonus Plugin
Reply With Quote #1

Hi guys!

I have got this plugin from somewhere what I exactly don't remember.
This is a knife kill bonus plugin.

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

#include <amxmodx>
#include <colorchat>
#include <fun>

#define PLUGIN "Knife Kill Bonus"
#define VERSION "1.1"
#define AUTHOR "Unknown"
#define CustomSound "sound/knifekill.mp3"

const TASK_ID 700

const Float:FAST_SPEED 480.0 //Your speed bonus

new const g_szSound[] = "knifekill.mp3"

new g_iSync
new bool:g_bHasSpeed[75]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""onDeathMsgEvent""a")
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1")
    
    
g_iSync CreateHudSyncObj()
}

public 
plugin_precache()
    
precache_sound(g_szSound)

public 
onDeathMsgEvent()
{
    new 
id read_data(1)
    
    new 
szWeapon[32]
    
read_data(4szWeaponcharsmax(szWeapon))
    
    if(
equal(szWeapon"knife") && is_user_alive(id))
    {
        new 
szName[32], szName2[32]
        
get_user_name(idszNamecharsmax(szName))
        
get_user_name(read_data(2), szName2charsmax(szName2))
        
        
set_hudmessage(255000.020.210.16.00.10.1, -1)
       
ColorChat(idprint_chat"^4[AMXX] Knife ^3%s ^4knived ^3%s ^4and got^3 10HP + 15 Sec Speed "szNameszName2)
        
set_hudmessage(255000.020.210.16.00.10.1, -1)
        
ShowSyncHudMsg(0g_iSync"Player %s knifed %s Hahahaha"szNameszName2)
        
    
/*client_cmd(id, "mp3 play %s", g_szSound)*/
    //client_cmd(id, "mp3 play %s", CustomSound)
client_cmd(0,"spk knifekill.mp3")
        
        
set_user_health(idget_user_healthid ) + 10 )
        
        
g_bHasSpeed[id] = true
        remove_task
(id TASK_ID)
        
set_task(15.0"taskRemoveSpeed"id TASK_ID)
        
set_user_maxspeed(idFAST_SPEED)
        
set_user_fragsidget_user_fragsid ) + )
    }
}

public 
onCurWeaponEvent(id)
    if(
g_bHasSpeed[id])
        
set_user_maxspeed(idFAST_SPEED)

public 
taskRemoveSpeed(id)
{
    
id -= TASK_ID
    g_bHasSpeed
[id] = false
    set_user_maxspeed
(id260.0)

I have some question about this plugin. First of all, this plugin makes sound in local system only. I want that if someone knife someone, sound must be for everyone even dead or alive in the server.

And the last thing I want it to choose a random song from my list of songs on each knife kill.

Thank you, this time I want to do it myself, so please guide me how can I do it.
__________________
SELLING COUNTER STRIKE SERVERS!! [email protected]

Cheap Rates/ Renting also available.
Introducing myself: This is Naman Vrati, call me NamVr! I am a web developer and Counter Strike Server Manager, I own a server.

Piano Is My Life
allroundernaman is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-27-2020 , 10:05   Re: Knife Kill Bonus Plugin
Reply With Quote #2

You can't pass 0 as ID in this function, so the best way to do this is probably to loop trough all player's like shown in code below:
PHP Code:
#include <amxmodx>
#include <colorchat>
#include <fun>

#define PLUGIN "Knife Kill Bonus"
#define VERSION "1.2"
#define AUTHOR "Unknown" 
#define CustomSound "sound/knifekill.mp3"

const TASK_ID 700

const Float:FAST_SPEED 480.0 //Your speed bonus

new const g_szSound[] = "knifekill.mp3"

new g_iSync
new bool:g_bHasSpeed[75]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_event("DeathMsg""onDeathMsgEvent""a");
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1");
    
    
g_iSync CreateHudSyncObj();
}

public 
plugin_precache()
{
    
precache_sound(g_szSound);
}


public 
onDeathMsgEvent()
{
    new 
id read_data(1);
    
    new 
szWeapon[32];
    
read_data(4szWeaponcharsmax(szWeapon));
    
    if(
equal(szWeapon"knife") && is_user_alive(id))
    {
        new 
szName[32], szName2[32];
        
get_user_name(idszNamecharsmax(szName));
        
get_user_name(read_data(2), szName2charsmax(szName2));
        
        
set_hudmessage(255000.020.210.16.00.10.1, -1);
        
ColorChat(idprint_chat"^4[AMXX] Knife ^3%s ^4knived ^3%s ^4and got^3 10HP + 15 Sec Speed "szNameszName2);
        
set_hudmessage(255000.020.210.16.00.10.1, -1);
        
ShowSyncHudMsg(0g_iSync"Player %s knifed %s Hahahaha"szNameszName2);
        
        
/*client_cmd(id, "mp3 play %s", g_szSound)*/
        //client_cmd(id, "mp3 play %s", CustomSound)

        
new iPlayers[32], iPnum;
        
get_players(iPlayersiPnum);

        for(new 
iidsiPnumi++)
        {
            
ids iPlayers[i];
            
client_cmd(ids,"spk knifekill.mp3");
        }
        
        
set_user_health(idget_user_healthid ) + 10 );
        
        
g_bHasSpeed[id] = true;
        
remove_task(id TASK_ID);
        
set_task(15.0"taskRemoveSpeed"id TASK_ID);
        
set_user_maxspeed(idFAST_SPEED);
        
set_user_fragsidget_user_fragsid ) + );
    }
}

public 
onCurWeaponEvent(id)
{
    if(
g_bHasSpeed[id])
    {
        
set_user_maxspeed(idFAST_SPEED);
    }
}

public 
taskRemoveSpeed(id)
{
    
id -= TASK_ID;
    
g_bHasSpeed[id] = false;
    
set_user_maxspeed(id260.0);

Tell me if it doesn't work
__________________
Private Work! || Discord:
Mr_Boopsy_#2066
supertrio17 is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 06-27-2020 , 14:06   Re: Knife Kill Bonus Plugin
Reply With Quote #3

client_cmd can have (0) as an index. API

Also I believe if you want to play .MP3 sound, you need to use mp3 play.
Code:
client_cmd(0, "mp3 play sound.mp3");

Last edited by ZaX; 06-27-2020 at 14:08.
ZaX is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-27-2020 , 14:22   Re: Knife Kill Bonus Plugin
Reply With Quote #4

Interesting, I tried it a few times, couldn't get it to work. Thanks
__________________
Private Work! || Discord:
Mr_Boopsy_#2066
supertrio17 is offline
AnimalMonster
Member
Join Date: May 2020
Old 06-29-2020 , 22:34   Re: Knife Kill Bonus Plugin
Reply With Quote #5

Quote:
Originally Posted by allroundernaman View Post
Hi guys!

I have got this plugin from somewhere what I exactly don't remember.
This is a knife kill bonus plugin.

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

#include <amxmodx>
#include <colorchat>
#include <fun>

#define PLUGIN "Knife Kill Bonus"
#define VERSION "1.1"
#define AUTHOR "Unknown"
#define CustomSound "sound/knifekill.mp3"

const TASK_ID 700

const Float:FAST_SPEED 480.0 //Your speed bonus

new const g_szSound[] = "knifekill.mp3"

new g_iSync
new bool:g_bHasSpeed[75]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""onDeathMsgEvent""a")
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1")
    
    
g_iSync CreateHudSyncObj()
}

public 
plugin_precache()
    
precache_sound(g_szSound)

public 
onDeathMsgEvent()
{
    new 
id read_data(1)
    
    new 
szWeapon[32]
    
read_data(4szWeaponcharsmax(szWeapon))
    
    if(
equal(szWeapon"knife") && is_user_alive(id))
    {
        new 
szName[32], szName2[32]
        
get_user_name(idszNamecharsmax(szName))
        
get_user_name(read_data(2), szName2charsmax(szName2))
        
        
set_hudmessage(255000.020.210.16.00.10.1, -1)
       
ColorChat(idprint_chat"^4[AMXX] Knife ^3%s ^4knived ^3%s ^4and got^3 10HP + 15 Sec Speed "szNameszName2)
        
set_hudmessage(255000.020.210.16.00.10.1, -1)
        
ShowSyncHudMsg(0g_iSync"Player %s knifed %s Hahahaha"szNameszName2)
        
    
/*client_cmd(id, "mp3 play %s", g_szSound)*/
    //client_cmd(id, "mp3 play %s", CustomSound)
client_cmd(0,"spk knifekill.mp3")
        
        
set_user_health(idget_user_healthid ) + 10 )
        
        
g_bHasSpeed[id] = true
        remove_task
(id TASK_ID)
        
set_task(15.0"taskRemoveSpeed"id TASK_ID)
        
set_user_maxspeed(idFAST_SPEED)
        
set_user_fragsidget_user_fragsid ) + )
    }
}

public 
onCurWeaponEvent(id)
    if(
g_bHasSpeed[id])
        
set_user_maxspeed(idFAST_SPEED)

public 
taskRemoveSpeed(id)
{
    
id -= TASK_ID
    g_bHasSpeed
[id] = false
    set_user_maxspeed
(id260.0)

I have some question about this plugin. First of all, this plugin makes sound in local system only. I want that if someone knife someone, sound must be for everyone even dead or alive in the server.

And the last thing I want it to choose a random song from my list of songs on each knife kill.

Thank you, this time I want to do it myself, so please guide me how can I do it.
If you want to do this thing convert the mp3 to wav and use emit_sound, that's the easiest method and the best one i think , i just think that it is

Last edited by AnimalMonster; 06-29-2020 at 22:36.
AnimalMonster 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 15:13.


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