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

[L4D & L4D2] Rock Glow


Post New Thread Reply   
 
Thread Tools Display Modes
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-07-2020 , 13:21   Re: [L4D & L4D2] Rock Glow
Reply With Quote #11

Well would be something like this

PHP Code:
...

        
GlowRock CreateEntityByName("prop_dynamic_override"); 
        if( 
GlowRock == -1)
        {
            
LogError("Failed to create 'prop_dynamic_override'");
            return;
        }
        
        
SDKHook(GlowRockSDKHook_SetTransmitOnSetTransmit);

...

public 
Action OnSetTransmit(int entityint client)
{
    if (
GetClientTeam(client) == 2)
        return 
Plugin_Continue//shows

    
return Plugin_Handled//hide

Maybe it works. I didn't test since I'm not with my dev PC now.
Also may need some other checks (like IsClientInGame etc)
__________________

Last edited by Marttt; 01-24-2020 at 08:33. Reason: Fixed wrong entity name on CreateEntityByName
Marttt is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-24-2020 , 07:26   Re: [L4D & L4D2] Rock Glow
Reply With Quote #12

prop_glowing_object is those special entity, that not react on SDKHook_SetTransmit, max fade distance and GlowForTeam for unknown reason.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-24-2020 , 08:20   Re: [L4D & L4D2] Rock Glow
Reply With Quote #13

I think I type the wrong entity in my post (edited, thanks for the report),

AshesBeneath asked for the L4D2 version, so it would be the the "prop_dynamic_override" entity instead of "prop_glowing_object"

Btw for "prop_glowing_object" this keyvalues should work

Spoiler


I think I did a test once with "Glow For Team" property in the past for L4D1 and it worked (limited options but may be an option)
__________________

Last edited by Marttt; 01-24-2020 at 08:33.
Marttt is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-24-2020 , 22:03   Re: [L4D & L4D2] Rock Glow
Reply With Quote #14

Stop using spaces and characters in your filenames. When downloading this is how it appears: "%5BL4D%20%26%20L4D2%5D%20Rock%20Glow.smx ". Instead follow the common standard: "l4d_rock_glow.sp"

Also edit your first post and click "Go Advanced", change the compiler needed to "1.9" or "1.10" it seems most likely to be on "1.1" which is preventing the forum compiling the plugin. There are no special includes that would prevent it from compiling and so the attached .SMX should not be required. This is a current bug with the forum when posting a plugin it defaults to 1.1, probably since 1.10 update.
__________________

Last edited by Silvers; 01-24-2020 at 22:10.
Silvers is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 12-20-2020 , 06:24   Re: [L4D & L4D2] Rock Glow
Reply With Quote #15

GlowForTeam does not seem to be supported in l4d2, is there any solution?
ProjectSky is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-20-2020 , 20:03   Re: [L4D & L4D2] Rock Glow
Reply With Quote #16

Read the previous posts, you probably will have to use SetTransmit, in a "clone" entity (AFAIK).
__________________
Marttt is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 12-21-2020 , 08:40   Re: [L4D & L4D2] Rock Glow
Reply With Quote #17

I use this code, but not working

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
strcmp(classname"tank_rock") == 0)
        
CreateTimer(1.0SpawnThinkentity);
}

public 
Action SpawnThink(Handle timerany entity)
{
    
RequestFrame(OnNextFrameEntIndexToEntRef(entity));
}

public 
void OnNextFrame(int entity)
{
    
int GlowRock = -1;
    
char sModel[128];
    
GetEntPropString(entityProp_Data"m_ModelName"sModelsizeof(sModel));
    
float vPos[3];
    
float vAng[3];
        
    
GetEntPropVector(entityProp_Data"m_vecOrigin"vPos);
    
GetEntPropVector(entityProp_Send"m_angRotation"vAng);
    
    
GlowRock CreateEntityByName("prop_dynamic_override"); 
    if(
GlowRock == -1)
    {
        
LogError("Failed to create 'prop_dynamic_override'");
        return;
    }
    
    
DispatchKeyValue(GlowRock"model"sModel);
    
DispatchKeyValue(GlowRock"glowcolor""255 255 255");
    
SetEntityRenderFx(GlowRockRENDERFX_FADE_FAST);
    
    
SetVariantString("!activator");
    
AcceptEntityInput(GlowRock"SetParent"entity);
    
DispatchSpawn(GlowRock);
    
AcceptEntityInput(GlowRock"StartGlowing");

    
SDKHook(GlowRockSDKHook_SetTransmitOnTransmit);
        
    
//TeleportEntity(GlowRock, vPos, vAng, NULL_VECTOR);
}

public 
Action OnTransmit(int entityint client)
{
    if (
GetClientTeam(client) == 3)
        return 
Plugin_Continue;

    return 
Plugin_Handled;


Last edited by ProjectSky; 12-21-2020 at 08:42. Reason: code highlighting
ProjectSky is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 12-21-2020 , 08:56   Re: [L4D & L4D2] Rock Glow
Reply With Quote #18

Damn, I forgot teleportentity, now it work for me. Thanks for your help
ProjectSky is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-21-2020 , 09:56   Re: [L4D & L4D2] Rock Glow
Reply With Quote #19

These topics may be also useful.
I didn't have a chance yet to try all suggestions:

https://forums.alliedmods.net/showthread.php?t=327995
https://forums.alliedmods.net/showthread.php?t=321947
https://forums.alliedmods.net/showthread.php?t=327557
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 12-25-2020 , 07:45   Re: [L4D & L4D2] Rock Glow
Reply With Quote #20

This code causes the server to crash random, anyone know why?

https://crash.limetech.org/jtv2twc6c54s

PHP Code:
public Action CreateGlowRock(Handle timerint entity)
{
    if (!
IsValidEntity(entity) || !IsValidEdict(entity)) return;
    
char sModel[128];

    
GetEntPropString(entityProp_Data"m_ModelName"sModelsizeof(sModel));
    
    
int rock CreateEntityByName("prop_dynamic_ornament"); 

    if (
rock == -1) return;
    
    
SetEntityModel(rocksModel);
    
DispatchSpawn(rock);
    
SetEntProp(rockProp_Send"m_nGlowRange"4500);
    
SetEntProp(rockProp_Send"m_iGlowType"2);
    
SetEntProp(rockProp_Send"m_glowColorOverride"0xFFFFFF);
    
AcceptEntityInput(rock"StartGlowing");

    
SetEntityRenderMode(rockRENDER_TRANSCOLOR);
    
SetEntityRenderColor(rock0000);

    
SetVariantString("!activator");
    
AcceptEntityInput(rock"SetAttached"entity);
    
AcceptEntityInput(rock"TurnOn");

    
SDKHook(rockSDKHook_SetTransmitOnTransmit);
}

public 
Action OnTransmit(int entityint client)
{
    if (
IsClientInGame(client))
    {
        
int zclass GetEntProp(clientProp_Send"m_zombieClass");
        
int team GetClientTeam(client);
        if (
zclass == 8) return Plugin_Handled;
        if (
team == || team == 3)
            return 
Plugin_Continue;
    }

    return 
Plugin_Handled;

ProjectSky 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 04:49.


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