This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved [L4D2]Exclude projectiles that have been thrown


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sorallll
Senior Member
Join Date: Oct 2018
Old 01-12-2022 , 12:52   [L4D2]Exclude projectiles that have been thrown
Reply With Quote #1

Is there a better way to get the player's weapon without throwing projectiles?

The method currently in use
PHP Code:
int g_iGrenadeThrower[MAXPLAYERS 1];
public 
void OnEntityCreated(int entity, const char[] classname)
{
    if(
classname[0] != 'm' && classname[0] != 'p' && classname[0] != 'v')
        return;

    if(
strncmp(classname"molotov_projectile"19) == || strncmp(classname"pipe_bomb_projectile"21) == || strncmp(classname"vomitjar_projectile"20) == 0)
        
SDKHook(entitySDKHook_SpawnPostHook_SpawnPost);
}

void Hook_SpawnPost(int entity)
{
    
SDKUnhook(entitySDKHook_SpawnPostHook_SpawnPost);
    if(
entity <= MaxClients || !IsValidEntity(entity))
        return;

    
int iOwner GetEntPropEnt(entityProp_Data"m_hOwnerEntity");
    if(
iOwner <= MaxClients && IsClientInGame(iOwner) && GetClientTeam(iOwner) == 2)
    {
        
int iSlot GetPlayerWeaponSlot(iOwner2);
        if(
iSlot MaxClients)
            
g_iGrenadeThrower[iOwner] = EntIndexToEntRef(iSlot);
    }
}

char sWeapon [32];
int iSlot GetPlayerWeaponSlot(client2);
if(
iSlot MaxClients)
{
    if(
EntIndexToEntRef(iSlot) != g_iGrenadeThrower[client])
    {
        
GetEntityClassname(iSlotsWeaponsizeof(sWeapon));
    }


Last edited by sorallll; 01-21-2022 at 13:16.
sorallll 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 10:55.


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