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

Solved [CS:GO/ANY?] Make balloons invisible doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-29-2018 , 18:25   [CS:GO/ANY?] Make balloons invisible doesn't work
Reply With Quote #1

Code:
stock CreateDefuseBalloons(client, Float:time=5.0)
{
	new particle = CreateEntityByName("info_particle_system");

	if (IsValidEdict(particle))
	{
		SDKHook(particle, SDKHook_SetTransmit, Hook_ShouldSeeBalloons);
		new Float:position[3];
		GetEntPropVector(client, Prop_Send, "m_vecOrigin", position);
		TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR);
		DispatchKeyValue(particle, "targetname", "uc_bomb_defused_balloons");
		DispatchKeyValue(particle, "effect_name", "weapon_confetti_balloons"); // This is the particle name that spawns confetti and balloons.
		DispatchSpawn(particle);
		//SetVariantString(name);
		ActivateEntity(particle);
		AcceptEntityInput(particle, "start");
		CreateTimer(time, DeleteDefuseBalloons, particle);
	}
}

public Action:Hook_ShouldSeeBalloons(balloons, viewer)
{
	return Plugin_Handled;
}

public Action:DeleteDefuseBalloons(Handle:timer, any:particle)
{
    if (IsValidEntity(particle))
    {
        new String:classN[64];
        GetEdictClassname(particle, classN, sizeof(classN));
        if (StrEqual(classN, "info_particle_system", false))
        {
            RemoveEdict(particle);
        }
    }
}
Why am I able to see the balloons?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 10-03-2018 at 02:47.
eyal282 is offline
vinci6k
New Member
Join Date: Jul 2018
Old 09-29-2018 , 19:46   Re: [CS:GO/ANY?] Make balloons invisible doesn't work
Reply With Quote #2

Particles have the FL_EDICT_ALWAYS flag on them, which makes them transmit to all clients no matter what. You need to strip it before attempting to hide them in the SetTransmit hook.
Code for stripping the flag can be found in this post by sidezz.
vinci6k is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 09-29-2018 , 19:47   Re: [CS:GO/ANY?] Make balloons invisible doesn't work
Reply With Quote #3

Because particles have the edict flag "FL_EDICT_ALWAYS"
you may want to change the flag so it will called with SetTransmit

SetEdictFlags(particle, FL_EDICT_FULLCHECK);?
dunno try it
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-30-2018 , 06:28   Re: [CS:GO/ANY?] Make balloons invisible doesn't work
Reply With Quote #4

Quote:
Originally Posted by Lux View Post
Because particles have the edict flag "FL_EDICT_ALWAYS"
you may want to change the flag so it will called with SetTransmit

SetEdictFlags(particle, FL_EDICT_FULLCHECK);?
dunno try it

Code:
stock CreateDefuseBalloons(client, Float:time=5.0)
{
	new particle = CreateEntityByName("info_particle_system");

	if (IsValidEdict(particle))
	{
		new Float:position[3];
		GetEntPropVector(client, Prop_Send, "m_vecOrigin", position);
		TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR);
		DispatchKeyValue(particle, "targetname", "uc_bomb_defused_balloons");
		DispatchKeyValue(particle, "effect_name", "weapon_confetti_balloons"); // This is the particle name that spawns confetti and balloons.
		DispatchSpawn(particle);
		//SetVariantString(name);
		ActivateEntity(particle);
		AcceptEntityInput(particle, "start");
		CreateTimer(time, DeleteDefuseBalloons, particle);
		
		if(GetEdictFlags(particle) & FL_EDICT_ALWAYS)
			SetEdictFlags(particle, GetEdictFlags(particle) ^ FL_EDICT_ALWAYS);
			
		SDKHook(particle, SDKHook_SetTransmit, Hook_ShouldSeeBalloons);
	}
}

public Action:Hook_ShouldSeeBalloons(balloons, viewer)
{
	return Plugin_Handled;
}

public Action:DeleteDefuseBalloons(Handle:timer, any:particle)
{
    if (IsValidEntity(particle))
    {
        new String:classN[64];
        GetEdictClassname(particle, classN, sizeof(classN));
        if (StrEqual(classN, "info_particle_system", false))
        {
            RemoveEdict(particle);
        }
    }
}
Doesn't work.

Edit: if I set a 1.5 timer to remove the always tag, settransmit is fired once and the balloons double themselves

Another edit: I need to make it individual so making it never transmit to all is not an option.

Last edit maybe: Settings the flags to FL_EDICT_FULLCHECK and nothing else also doesn't work.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 09-30-2018 at 07:04.
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-03-2018 , 02:47   Re: [CS:GO/ANY?] Make balloons invisible doesn't work
Reply With Quote #5

https://forums.alliedmods.net/showthread.php?t=311043

Solved, this plugin has the function to properly hide. The issue is weird, you gotta set the flags inside the settransmit hook, and I think during entity creation as well, as it gets overriden after one transmit.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 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 03:23.


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