AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   TF2 setting Cloak Meter value (https://forums.alliedmods.net/showthread.php?t=67699)

DJ Tsunami 02-29-2008 10:49

TF2 setting Cloak Meter value
 
Does anyone know if it's possible to set the value of the Cloak Meter? I found:
Code:

FindSendPropOffs("CTFPlayer", "m_flCloakMeter");
And then for example:
Code:

public Action:OnClientCommand(client, args) {
  PrintToChat(client, "%f", GetEntDataFloat(client,
FindSendPropOffs("CTFPlayer", "m_flCloakMeter")));
}

But it always returns 0.
000000 for me. According to this page this is what all the classes return, but the person that wrote this post says it returned 100.000000 for him. Any ideas are appreciated :)

Muridias 02-29-2008 14:52

Re: TF2 setting Cloak Meter value
 
Funny I was playing around with the cloak meter a few days ago. I also keep getting 0.00000. If I tried to send a value to it the server would crash.

Found out what the problem is.

Use FindSendPropInfo instead of FindSendPropOffs

DJ Tsunami 03-01-2008 04:12

Re: TF2 setting Cloak Meter value
 
Awesome, that was exactly what I was looking for. Thank you very much.

naris 03-04-2008 22:08

Re: TF2 setting Cloak Meter value
 
Quote:

Originally Posted by DJ Tsunami (Post 591216)
Does anyone know if it's possible to set the value of the Cloak Meter?

If you set it to 0.0 on a spy that is cloaked, he will become uncloaked. If you set it larger, the spy will remain cloaked for a longer period of time. THe number also shows up as the number of bars in the spy's wristwatch/cloak meter.

There are also bits in m_nPlayerCond
Code:

FindSendPropInfo("CTFPlayer","m_nPlayerCond");
that relate to cloaking and uber,etc.

if m_nPlayerCond & 32 then the player is ubered.
if m_nPlayerCond & 16 then the spy is cloaked.
if m_nPlayerCond & 8 then the spy is disguised.
if m_nPlayerCond & 1 then the player is slowed (sniper is zoomed or heavy is firing or spinning his barrel)

Turning off bit 16 will uncloak a spy.
Turning off bit 8 will un-disguise him.

Muridias 03-07-2008 13:24

Re: TF2 setting Cloak Meter value
 
Quote:

Originally Posted by naris (Post 593261)
There are also bits in m_nPlayerCond
Code:

FindSendPropInfo("CTFPlayer","m_nPlayerCond");
that relate to cloaking and uber,etc.

if m_nPlayerCond & 32 then the player is ubered.
if m_nPlayerCond & 16 then the spy is cloaked.
if m_nPlayerCond & 8 then the spy is disguised.
if m_nPlayerCond & 1 then the player is slowed (sniper is zoomed or heavy is firing or spinning his barrel)

Turning off bit 16 will uncloak a spy.
Turning off bit 8 will un-disguise him.

128 is taunting.
24 is when spy is cloak with disguise.
16 is when spy is cloak without disguise.
4 is when spy is currently disguiseing himself.
3 is sniper zoomed.
1 is heavy spinning barrel.
0 is when spy isn't cloak and isn't disguise.

I forget the number when you are being healed.

Scuzzy 03-10-2008 12:31

Re: TF2 setting Cloak Meter value
 
Quote:

Originally Posted by naris (Post 593261)
If you set it to 0.0 on a spy that is cloaked, he will become uncloaked. If you set it larger, the spy will remain cloaked for a longer period of time. THe number also shows up as the number of bars in the spy's wristwatch/cloak meter.

There are also bits in m_nPlayerCond
Code:

FindSendPropInfo("CTFPlayer","m_nPlayerCond");
that relate to cloaking and uber,etc.

if m_nPlayerCond & 32 then the player is ubered.
if m_nPlayerCond & 16 then the spy is cloaked.
if m_nPlayerCond & 8 then the spy is disguised.
if m_nPlayerCond & 1 then the player is slowed (sniper is zoomed or heavy is firing or spinning his barrel)

Turning off bit 16 will uncloak a spy.
Turning off bit 8 will un-disguise him.

Have you actually been able to set these and see the effects on the players appearance?

bl4nk 03-10-2008 14:23

Re: TF2 setting Cloak Meter value
 
I tested them out the spy ones. You can remove their cloak and disguise, but you can't set it. You can also stop a player from taunting.

naris 03-18-2008 18:15

Re: TF2 setting Cloak Meter value
 
Quote:

Originally Posted by Muridias (Post 594232)
128 is taunting.
24 is when spy is cloak with disguise.
16 is when spy is cloak without disguise.
4 is when spy is currently disguiseing himself.
3 is sniper zoomed.
1 is heavy spinning barrel.
0 is when spy isn't cloak and isn't disguise.

24 == 16 + 8 (16 for cloak + 8 for disguise)
3 == 1 + 2 (1 for slowed + 2 for zoomed?)

I think healing might be 64? I'll have to check again.

Quote:

Originally Posted by Scuzzy (Post 595250)
Have you actually been able to set these and see the effects on the players appearance?

I have been able to uncloak and undisguise spys using m_nPlayerCond by turning the appropriate bits off.

At one time I had a bug in my code that would made spys look ubered, I am not sure what it was, but I think it had something to do with m_nPlayerCond.

CoolJosh3k 09-28-2013 23:48

Re: TF2 setting Cloak Meter value
 
As a follow up for this old thread, I have an question...

How can one set the amount of cloak and then force the cloak? Of course, naturally only the spy could self-toggle the cloak.

Here is what I have:

PHP Code:

new CloakMeterPointer;
public 
OnPluginStart()
{
    
HookEvent("arena_round_start"ArenaRoundEventHookMode_PostNoCopy);
    
CloakMeterPointer FindSendPropInfo("CTFPlayer""m_flCloakMeter");
}

public 
ArenaRound(Handle:event, const String:name[], bool:dontBroadcast)        //Begin round
{
    
CreateTimer(0.3Delay_Timer);
}

public 
Action:Delay_Timer(Handle:timer)
{
    for(new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && IsPlayerAlive(i) && IsValidEntity(i))
        {
            
SetEntDataFloat(iCloakMeterPointer3.0true);
            
TF2_AddCondition(iTFCond_Cloaked, -1.0);
        }
    }


I am just using 3 seconds as a test, but it appears as though the player has no cloak amount. They do the normal cloaking, but just uncloak as they no juice left.

Must be something simple that I am missing here, but I just don't know what it is.

Powerlord 09-29-2013 03:01

Re: TF2 setting Cloak Meter value
 
Have you tried different values for m_flCloakMeter? I can't tell you if 1.0 is 100% or 1%.

Edit: Oh, this is bumping an old thread.

If you want to force a Spy to cloak, use FakeClientCommand to force them to do +attack2. But be aware if they're already cloaked, this will decloak them... and will have no effect if a DR Spy is uncloaked and doesn't have a full cloak meter.

Edit2: btw, SetEntPropFloat(ent, Prop_Send, "m_flCloakMeter", 3.0) is probably safer than FindSendProp*/SetEntData.


All times are GMT -4. The time now is 20:36.

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