View Single Post
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