Raised This Month: $32 Target: $400
 8% 

Solved [L4D2] Glowing ammunition problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
leaffan
Senior Member
Join Date: Jan 2013
Old 04-14-2021 , 13:39   [L4D2] Glowing ammunition problem
Reply With Quote #1

Hello guys, (Sorry, I don't speak English!)

The attached attachment also has a problem that you can see in the picture, it appears regardless of the map, whether the weapon or equipment ammunition is actually not there, but it still seems to exist. Can we fix this?

Picture:
Picture: https://prnt.sc/11ea4nj
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_items_glow.sp - 53 views - 19.1 KB)

Last edited by leaffan; 04-14-2021 at 14:04.
leaffan is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 04-14-2021 , 14:01   Re: [L4D2] Glowing ammunition problem
Reply With Quote #2

this happens because it is a "spawner" entity, you can check what I did in my [L4D2] Random Glow Item plugin.

I usually do this:

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
HasEntProp(entityProp_Data"m_itemCount")) // *_spawn entities
    
{
        
SDKHook(entitySDKHook_UsePostOnUsePost);
    }
}

public 
void OnUsePost(int entityint activatorint callerUseType typefloat value)
{
    
int count GetEntProp(entityProp_Data"m_itemCount");

    if (
count == 0)
        
AcceptEntityInput(entity"Kill");

__________________

Last edited by Marttt; 04-14-2021 at 14:02.
Marttt is offline
leaffan
Senior Member
Join Date: Jan 2013
Old 04-14-2021 , 14:03   Re: [L4D2] Glowing ammunition problem
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
this happens because it is a "spawner" entity, you can check what I did in my [L4D2] Random Glow Item plugin.

I usually do this:

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
HasEntProp(entityProp_Data"m_itemCount")) // *_spawn entities
    
{
        
SDKHook(entitySDKHook_UsePostOnUsePost);
    }
}

public 
void OnUsePost(int entityint activatorint callerUseType typefloat value)
{
    
int count GetEntProp(entityProp_Data"m_itemCount");

    if (
count == 0)
        
AcceptEntityInput(entity"Kill");

Thank you.
leaffan 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 17:57.


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