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

[CSS/CSGO] Fire C4 death Event - SM plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-03-2017 , 12:18   [CSS/CSGO] Fire C4 death Event - SM plugin
Reply With Quote #1


net_showevent 2 output



This plugin example trigger death events which happen when players die in C4 exlosion.
-Above in "spoiler" you see net_showevents 2 output when these events happen. (After "bomb_exploded")
- This should help on other plugins which normally follow player_death event. But can also bring more trouble, ex. team killing.
- You not necessary need this

PHP Code:
#include <sdkhooks>

public void OnPluginStart()
{
    
HookEventEx("bomb_exploded"bomb_exploded);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void OnClientPutInServer(int client)
{
    if(!
IsClientSourceTV(client) && !IsClientReplay(client))
        
SDKHookEx(clientSDKHook_OnTakeDamagePostOnTakeDamagePost);
}

ArrayList List_C4_Death;

public 
void bomb_exploded(Event event, const char[] namebool dontBroadcast)
{
    if(
List_C4_Death != INVALID_HANDLE)
    {
        for(
int x 0List_C4_Death.Lengthx++)
        {
            
Event event_death CreateEvent("player_death"true);

            if (
event_death == INVALID_HANDLE)
            {
                return;
            }

            
event_death.SetInt("userid"List_C4_Death.Get(x));
            
event_death.SetInt("attacker"event.GetInt("userid"));
            
event_death.SetString("weapon""c4");
            
event_death.SetBool("noreplay"true);
            
event_death.Fire();
        }
        
delete List_C4_Death;
    }
}

public 
void OnTakeDamagePost(int victimint attackerint inflictorfloat damageint damagetype)
{
    
// Don't pass alive players
    
if(IsPlayerAlive(victim)) return;


    if(
attacker MaxClients)
    {
        
// Entity

        
char buffer[30];
        if(
GetEntityClassname(attackerbuffersizeof(buffer)) && StrEqual(buffer"planted_c4"false))
        {
            if(
List_C4_Death == INVALID_HANDLE)
            {
                
List_C4_Death = new ArrayList(30);
            }

            
List_C4_Death.Push(GetClientUserId(victim));
        }
    }

Attached Thumbnails
Click image for larger version

Name:	csgocss.png
Views:	620
Size:	89.5 KB
ID:	165307  
__________________
Do not Private Message @me

Last edited by Bacardi; 09-05-2017 at 08:21.
Bacardi is offline
ReymonARG
Junior Member
Join Date: Jun 2017
Old 09-07-2017 , 23:25   Re: [CSS/CSGO] Fire C4 death Event - SM plugin
Reply With Quote #2

thanks this is a good method to get player that death by c4. I was using only takedamage, but you add bomb_explode, so thanks!!
ReymonARG 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 14:41.


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