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

My instant kill knife plugin stopped workin :( (After Update)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BulgarPL
Member
Join Date: Dec 2015
Old 08-22-2017 , 07:55   My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #1

Code:
#include <sourcemod>
#include <cmod>

new bool:maPerk[MAXPLAYERS+1] = false;

public OnPluginStart(){
	Cmod_RegisterItem("Noz Komandosa", "Natychmiastowe zabicie z noza (PPM)", 1, 1, 250, INVALID_HANDLE);
}

public Cmod_OnItemEnabled(client, itemID, value){
	maPerk[client] = true;
}

public Cmod_OnItemDisabled(client, itemID){
	maPerk[client] = false;
}

public OnClientPutInServer(client)
{
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public OnClientDisconnect(client)
{
	SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
	if(!IsValidClient(victim) || !IsValidClient(attacker))
		return Plugin_Continue;
	if(!IsValidAlive(victim))
		return Plugin_Continue;
	if(maPerk[attacker])
	{
		new String:weapon[32];
		GetClientWeapon(attacker, weapon, 31);
		if((GetClientButtons(attacker) & IN_ATTACK2) && StrEqual(weapon, "weapon_knife") && (damagetype & DMG_SLASH))
		{
			damage = float(GetClientHealth(victim)) * 3.0;
			return Plugin_Changed;
		}
	}
	return Plugin_Continue;
}
I was using it on my COD MOD serwer it was workin before the update
SM 6024
BulgarPL is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 08-23-2017 , 01:48   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #2

Quote:
#include <sourcemod>
#include <cmod>

new bool:maPerk[MAXPLAYERS+1] = false;

public OnPluginStart(){
Cmod_RegisterItem("Noz Komandosa", "Natychmiastowe zabicie z noza (PPM)", 1, 1, 250, INVALID_HANDLE);
}

public Cmod_OnItemEnabled(client, itemID, value){
maPerk[client] = true;
}

public Cmod_OnItemDisabled(client, itemID){
maPerk[client] = false;
}

public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public OnClientDisconnect(client)
{
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if(!IsValidClient(victim) || !IsValidClient(attacker))
return Plugin_Continue;
if(!IsValidAlive(victim))
return Plugin_Continue;
if(maPerk[attacker])
{
new String:weapon[32];
GetClientWeapon(attacker, weapon, 31);
if((GetClientButtons(attacker) & IN_ATTACK2) && StrEqual(weapon, "weapon_knife") && (damagetype & DMG_SLASH))
{
damage *= 500;
return Plugin_Changed;
}
}
Instend using "damage = float(GetClientHealth(victim)) * 3.0;" just use "damage *= 500;", it will change the damage to * 500 and will make sure that player will die, works on my server.
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-23-2017 , 06:34   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #3

after
new String:weapon[32];
GetClientWeapon(attacker, weapon, 31);
add LogMessage(weapon);
and what you get
8guawong is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-23-2017 , 09:34   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #4

There is something wrong witch

Quote:
StrEqual(weapon, "weapon_knife")
When i remove this part of code my plugin is working again, but i need it witch weapon_knife...
What is the new funcion to get weapon_knife in plugin working again?
BulgarPL is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-23-2017 , 13:01   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #5

what does LogMessage(weapon); show?
8guawong is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-23-2017 , 15:21   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #6

Quote:
Originally Posted by 8guawong View Post
what does LogMessage(weapon); show?
[noz_komandosa.smx] weapon_knife_survival_bowie
BulgarPL is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-23-2017 , 16:50   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #7

I just fixed it by adding all knife names in my plugin.
BulgarPL is offline
brunoronning
Senior Member
Join Date: Jan 2014
Location: Brazil
Old 08-23-2017 , 22:47   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #8

Quote:
Originally Posted by BulgarPL View Post
I just fixed it by adding all knife names in my plugin.
Just use:
PHP Code:
if (StrContains(weapon"weapon_knife"false) != -1)
{
 
//code

or:
PHP Code:
public Action OnTakeDamage(int iVictimint &iAttackerint &inflictorfloat &fDamageint &iDamagetypeint &iWeapon)
{
    if (!
IsValidClient(iVictim) || !IsValidClient(iAttacker))
        return 
Plugin_Continue;

    if (!
IsValidAlive(iVictim) || !IsValidEdict(iWeapon))
        return 
Plugin_Continue;
        
    if (
maPerk[iAttacker])
    {
        
char sWeapon[MAX_NAME_LENGTH];
        
GetEdictClassname(iWeaponsWeaponsizeof(sWeapon));

        if ((
GetClientButtons(iAttacker) & IN_ATTACK2) && StrEqual(sWeapon"weapon_knife") && (iDamagetype DMG_SLASH))
        {
            
fDamage *= 500;
            return 
Plugin_Changed;
        }
    }
    return 
Plugin_Continue;


Last edited by brunoronning; 08-23-2017 at 22:54.
brunoronning is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-23-2017 , 23:19   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #9

The bayonet is weapon_bayonet now it no longer contains knife in the name
Dr!fter is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-24-2017 , 10:57   Re: My instant kill knife plugin stopped workin :( (After Update)
Reply With Quote #10

Quote:
weapon_bayonet
True... Thats why i just added all knifes :p

Fixed ./Close
BulgarPL 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 07:45.


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