Raised This Month: $ Target: $400
 0% 

How to do if a player kills another player that will not be registered that he killed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joel177
Junior Member
Join Date: Aug 2017
Old 09-04-2017 , 09:00   How to do if a player kills another player that will not be registered that he killed
Reply With Quote #1

How to do if a player kills another player that will not be registered that he killed him?

Thanks to the one who helps and this is to TF2
joel177 is offline
Rachnus
Senior Member
Join Date: Jun 2016
Location: Funland
Old 09-04-2017 , 09:14   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #2

Nice release!

https://github.com/Rachnus/HitmanCSG...ancsgo.sp#L572

HookEvent("player_death", Event_PlayerDeath); in plugin start


then in the callback set event.BroadcastDisabled = true;
__________________
Github: https://github.com/jimppan
Steam: http://steamcommunity.com/id/jimppan
_____________________________________________ _________
Taking private requests
Rachnus is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 09-04-2017 , 09:44   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #3

Although this is the wrong forum section to ask help for, here you go:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_death"OnPlayerDeathEventHookMode_Pre);
}

public 
Action OnPlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid")),
         
attacker GetClientOfUserId(event.GetInt("attacker"));
    
    if (!
IsValidClient(victim) || !IsValidClient(attacker) || victim == attacker)
    {
        return 
Plugin_Continue;
    }
    
    
event.BroadcastDisabled true;
    return 
Plugin_Continue;
}

stock bool IsValidClient(int client)
{
    return (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) > 1);


Last edited by cravenge; 09-04-2017 at 10:02. Reason: A typo..
cravenge is offline
joel177
Junior Member
Join Date: Aug 2017
Old 09-04-2017 , 09:58   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #4

Quote:
Originally Posted by cravenge View Post
Although this is the wrong forum section to ask help for, here you go:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_death"OnPlayerDeathEventHookMode_Pre);
}

public 
Action OnPlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid")),
         
attacker GetClientOfUserid(event.GetInt("attacker"));
    
    if (!
IsValidClient(victim) || !IsValidClient(attacker) || victim == attacker)
    {
        return 
Plugin_Continue;
    }

    
    
event.BroadcastDisabled true;
    return 
Plugin_Continue;
}

stock bool IsValidClient(int client)
{
    return (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) > 1);

There is an error in attacker = GetClientOfUserid (event.GetInt ("attacker"));
joel177 is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 09-04-2017 , 09:59   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #5

What is the errror?
ItsExTacY is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 09-04-2017 , 10:03   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #6

Whoops, a typo. My post has been edited.
cravenge is offline
joel177
Junior Member
Join Date: Aug 2017
Old 09-04-2017 , 10:03   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #7

Quote:
Originally Posted by ItsExTacY View Post
What is the errror?
I do not know but it says there's an error in it
joel177 is offline
joel177
Junior Member
Join Date: Aug 2017
Old 09-04-2017 , 10:05   Re: How to do if a player kills another player that will not be registered that he ki
Reply With Quote #8

Quote:
Originally Posted by cravenge View Post
Whoops, a typo. My post has been edited.
No matter it has been fixed thanks
joel177 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 02:33.


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