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

Solved In player_death Check for weapon_healthshot ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 09-13-2021 , 02:44   In player_death Check for weapon_healthshot ?
Reply With Quote #1

I am writing a pluginfor CSGO that when a player dies if they have a weapon_healthshot a center text message will print.
This works but I only want to see this message if I was the person that killed them and made them drop the healthshot.

Edit:
After a LOT of messing around, Got it working!

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>

new droppedShot[MAXPLAYERS];

public 
OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Post);
    
HookEvent("player_death",    Event_PlayerDeathEventHookMode_Post);
     
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
        
droppedShot[i] = 0;
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_WeaponDropPostHook_WeaponDropPost);
}

public 
Hook_WeaponDropPost(clientweapon)
{
    if(
weapon >= 0)
    {
        new 
String:weaponName[128];
        
GetEdictClassname(weaponweaponNamesizeof(weaponName));
        if (
strcmp(weaponName"weapon_healthshot") == 0)
            if (
client <= MaxClients)
                
droppedShot[client] = 1;
    }
}

public 
Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int attacked GetClientOfUserId(event.GetInt("userid"));
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (
droppedShot[attacked] == && ((attacked <= MaxClients) && (attacker <= MaxClients)))
    {
        
droppedShot[attacked] = 0;
        
PrintToServer("Event_PlayerDeath - %d-%N - Dropped Shot! - <><><><><><><><>"attackedattacked);
        
PrintCenterText(attacker,"<><><><><><><><><> - %N - Dropped SHOT! - <><><><><><><><><>"attacked);
    }
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if (
client <= MaxClients)
        
droppedShot[client] = 0;


Last edited by Austin; 09-14-2021 at 20:24.
Austin is offline
 



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 20:21.


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