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

TF2 setting Cloak Meter value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 02-29-2008 , 10:49   TF2 setting Cloak Meter value
Reply With Quote #1

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
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Muridias
Member
Join Date: Feb 2008
Old 02-29-2008 , 14:52   Re: TF2 setting Cloak Meter value
Reply With Quote #2

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

Last edited by Muridias; 02-29-2008 at 15:06.
Muridias is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 03-01-2008 , 04:12   Re: TF2 setting Cloak Meter value
Reply With Quote #3

Awesome, that was exactly what I was looking for. Thank you very much.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 03-04-2008 , 22:08   Re: TF2 setting Cloak Meter value
Reply With Quote #4

Quote:
Originally Posted by DJ Tsunami View Post
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.
naris is offline
Muridias
Member
Join Date: Feb 2008
Old 03-07-2008 , 13:24   Re: TF2 setting Cloak Meter value
Reply With Quote #5

Quote:
Originally Posted by naris View Post
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.
Muridias is offline
Scuzzy
Senior Member
Join Date: Oct 2007
Old 03-10-2008 , 12:31   Re: TF2 setting Cloak Meter value
Reply With Quote #6

Quote:
Originally Posted by naris View Post
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?
Scuzzy is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-10-2008 , 14:23   Re: TF2 setting Cloak Meter value
Reply With Quote #7

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.
bl4nk is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 03-18-2008 , 18:15   Re: TF2 setting Cloak Meter value
Reply With Quote #8

Quote:
Originally Posted by Muridias View Post
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 View Post
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.
naris is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 09-28-2013 , 23:48   Re: TF2 setting Cloak Meter value
Reply With Quote #9

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.
CoolJosh3k is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-29-2013 , 03:01   Re: TF2 setting Cloak Meter value
Reply With Quote #10

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.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-29-2013 at 03:30.
Powerlord is offline
Reply


Thread Tools
Display Modes

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 13:52.


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