AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [TF2] Addcond (https://forums.alliedmods.net/showthread.php?t=98542)

MikeJS 07-26-2009 12:47

[TF2] Addcond
 
PHP Code:

stock TF2_AddCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^FCVAR_NOTIFY);
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"addcond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }
}
stock TF2_RemoveCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^FCVAR_NOTIFY);
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"removecond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }


TF2_AddCond(client, 5) will ubercharge a player and TF2_AddCond(client, 11) will kritzkrieg them (works with tf_weapon_criticals 0).

Chris-_- 07-26-2009 13:13

Re: [TF2] Addcond
 
Brilliant stocks :D

J-Factor 07-26-2009 13:37

Re: [TF2] Addcond
 
Wow.

This is amazing. How did you find the commands?

The possibilities are endless... just after a quick test I've found you can make any class disguise (if you also set the appropriate props).

Great work.

EDIT:

From my quick testing:

0 = Civilian
1 = Sniper Scope (doesn't zoom in)
2 = Start of Disguise sequence
3 = Disguise (set m_nDisguiseTeam, etc. after applying to select the team/class/player/weapon)
4 = Cloak (only seems to work with Spy)
5 = Uber
6 = Glow from recently using a teleporter
7 = Useless (this is used for when you taunt)
8 = Unknown
9 = Unknown (probably useless since it doesn't alter your condition)
10 = Unknown
11 = Kritz (seems to disable when you kill someone)
12 = Unknown
13 = Unknown (probably useless since it doesn't alter your condition)
14 = Bonk'd (only lasts 5 seconds for Scout; interesting note: if you taunt you stay in third person even with sv_cheats 0)
15 = Useless (this is used for when you are slowed after drinking Bonk and when you're stunned)
16 = Unknown
17 = Useless (this is used for when you are ignited, makes you say fire voice response)
18 = Unknown
19 = Jarate

Example code to disguise as your class on the enemy team (after adding condition 3):

Code:

SetEntProp(client, Prop_Send, "m_nDisguiseClass", TF2_GetPlayerClass(client));
SetEntProp(client, Prop_Send, "m_nDisguiseTeam", GetClientTeam(client) == 2 ? 3 : 2);


Chris-_- 07-26-2009 13:42

Re: [TF2] Addcond
 
Please share everything you have on this.

Chris-_- 07-26-2009 13:50

Re: [TF2] Addcond
 
/del

Sexual Harassment Panda 07-26-2009 15:48

Re: [TF2] Addcond
 
I'm kind of confused as to how to use this, but that's probably just me.

MikeJS 07-26-2009 16:06

Re: [TF2] Addcond
 
Quote:

Originally Posted by J-Factor (Post 882300)
This is amazing. How did you find the commands?

Some guy named Aron added be on steam and PM'ed me them

bl4nk 07-26-2009 16:17

Re: [TF2] Addcond
 
Code:

#define PLAYERCOND_SLOWED (1<<0) //1
#define PLAYERCOND_ZOOMED (1<<1) //2
#define PLAYERCOND_DISGUISING (1<<2) //4
#define PLAYERCOND_DISGUISED (1<<3) //8
#define PLAYERCOND_SPYCLOAK (1<<4) //16
#define PLAYERCOND_UBERED (1<<5) //32
#define PLAYERCOND_TELEPORTTRAIL (1<<6) //64
#define PLAYERCOND_TAUNT (1<<7) //128
// (1<<8) //256
// (1<<9) //512
#define PLAYERCOND_TELEPORTFLASH (1<<10) //1024
#define PLAYERCOND_KRUBER (1<<11) //2048
// (1<<12) //4096
// (1<<13) //8192
#define PLAYERCOND_BONKED (1<<14) //16384 (blame Neph if it doesn't work)
#define PLAYERCOND_BONKEDORDRINKSLOWDOWN (1<<15) //32768
#define PLAYERCOND_HEALING (1<<16) //65536
#define PLAYERCOND_BURNING (1<<17) //131072
#define PLAYERCOND_FULLYCHARGEDBYMEDIC (1<<18) //262144


Chris-_- 07-26-2009 17:25

Re: [TF2] Addcond
 
Thank you, was looking for that one

Gachl 07-27-2009 02:02

Re: [TF2] Addcond
 
My hero! +K for you!

devicenull 07-27-2009 21:35

Re: [TF2] Addcond
 
No, please remove all the sv_cheats handling. That is unnecessary once you have removed the FCVAR_CHEATS flag, and opens the server up to a number of security issues. I see many servers a day exploited because they had cheats on.. plugins should never toggle it to use various features.

pheadxdll 07-28-2009 01:44

Re: [TF2] Addcond
 
Can't get this working without blacking out my server. (Works, just induces darkness)

I've tried removing the cheat flags on addcond with no luck. Anybody get this working?

MikeJS 07-28-2009 04:33

Re: [TF2] Addcond
 
Quote:

Originally Posted by devicenull (Post 883499)
No, please remove all the sv_cheats handling. That is unnecessary once you have removed the FCVAR_CHEATS flag, and opens the server up to a number of security issues. I see many servers a day exploited because they had cheats on.. plugins should never toggle it to use various features.

FindConVar won't find addcond (it's similar to nextmap/timeleft etc) so you can't remove the flag how you would for other commands.

bl4nk 07-28-2009 15:58

Re: [TF2] Addcond
 
Try something like this:
PHP Code:

stock bool:AddCond(clientcond)
{
    
    
decl String:name[64];
    new 
Handle:cvarbool:isCommandflagsHandle:convar;
    
    
cvar FindFirstConCommand(namesizeof(name), isCommandflags);
    if (
cvar == INVALID_HANDLE)
    {
        return 
false;
    }

    do
    {
        if (!
isCommand)
        {
            continue;
        }

        if (
strcmp(name"addcond") == 0)
        {
            
SetConVarFlags(cvarflags|~FCVAR_CHEAT);
            
FakeClientCommand(client"addcond %i"cond);
            
SetConVarFlags(cvarflags);
            return 
true;
        }
    } while (
FindNextConCommand(cvarnamesizeof(name), isCommandflags));

    return 
false;
}

stock bool:RemoveCond(clientcond)
{
    
    
decl String:name[64];
    new 
Handle:cvarbool:isCommandflagsHandle:convar;
    
    
cvar FindFirstConCommand(namesizeof(name), isCommandflags);
    if (
cvar == INVALID_HANDLE)
    {
        return 
false;
    }

    do
    {
        if (!
isCommand)
        {
            continue;
        }

        if (
strcmp(name"removecond") == 0)
        {
            
SetConVarFlags(cvarflags|~FCVAR_CHEAT);
            
FakeClientCommand(client"removecond %i"cond);
            
SetConVarFlags(cvarflags);
            return 
true;
        }
    } while (
FindNextConCommand(cvarnamesizeof(name), isCommandflags));

    return 
false;


They should return true on success, false on failure (couldn't find cvar list or couldn't find cmd).

pheadxdll 07-28-2009 16:06

Re: [TF2] Addcond
 
Did not work blank. :( No fail states occurred.

I haven't had any success calling CTFPlayerShared::AddCond(int, float) either. Lots of server crashes. So I would be happy if someone got this working. :3

CrimsonGT 07-28-2009 23:56

Re: [TF2] Addcond
 
The CTFPlayerShared::AddCond works fine from a MMS plugin. If your trying to do it with an SDKCall thats your problem, you cant make SDKCalls with CTFPlayerShared functions.

pheadxdll 07-29-2009 00:16

Re: [TF2] Addcond
 
Quote:

Originally Posted by CrimsonGT (Post 884529)
The CTFPlayerShared::AddCond works fine from a MMS plugin. If your trying to do it with an SDKCall thats your problem, you cant make SDKCalls with CTFPlayerShared functions.

Orly. Well, now I know, thanks Crimson! :grrr:

DontWannaName 07-29-2009 02:10

Re: [TF2] Addcond
 
and knowing is half the battle!

pheadxdll 07-29-2009 04:51

Re: [TF2] Addcond
 
Much to my surprise, I got it working via an MM:S plugin. :D The float value is the toggle between on and off. 0 is off and any thing greater turns on a condition.

A lot of neat stuff you can do with this. That said, I'm surprised a native for AddCond hasn't been introduced into the tf2 extension. I had to make my own. :mrgreen:

Chris-_- 07-29-2009 17:18

Re: [TF2] Addcond
 
Care to post an extension providing the native for plugins? *anyone*

Quimbo 07-29-2009 18:58

Re: [TF2] Addcond
 
Indeed, I'd be interested in seeing the extension as well, especially as an example how to do it.

Would be nice!

BrutalGoerge 08-02-2009 01:15

Re: [TF2] Addcond
 
seems uber cond won't work on the losing team

*cry

Chris-_- 08-02-2009 09:40

Re: [TF2] Addcond
 
All of em are conditional *shock*, like if you get healed by a medic, you loose uber aswell because they're ubermeter *usually* is lower then 100%.

Wazz 08-02-2009 18:10

Re: [TF2] Addcond
 
Just what I was looking for, many thanks MikeJS.

Theme97 08-02-2009 19:06

Re: [TF2] Addcond
 
Better cheats handling:
PHP Code:

stock TF2_AddCond(clientcond) {
    new 
flags GetCommandFlags("addcond");
    
SetCommandFlags("addcond"flags & ~FCVAR_CHEAT);
    
FakeClientCommand(client"addcond %d"cond);
    
SetCommandFlags("addcond"flags);


Written in quick-reply box but I use this method in Randomizer and it works just fine.

genkernel 08-04-2009 09:03

Re: [TF2] Addcond
 
Quote:

Originally Posted by Theme97 (Post 888766)
Better cheats handling:
PHP Code:

stock TF2_AddCond(clientcond) {
    new 
flags GetCommandFlags("addcond");
    
SetCommandFlags("addcond"flags & ~FCVAR_CHEAT);
    
FakeClientCommand(client"addcond %d"cond);
    
SetCommandFlags("addcond"flags);


Written in quick-reply box but I use this method in Randomizer and it works just fine.

Doesn't work for me, Still needed to enable cheats before it would work.

Theme97 08-04-2009 13:40

Re: [TF2] Addcond
 
Quote:

Originally Posted by genkernel (Post 889965)
Doesn't work for me, Still needed to enable cheats before it would work.

Hah, just realized I tested on my listen server where sv_cheats is always on.

Gonna try various methods to see what does work.

EHG 08-22-2009 09:42

Re: [TF2] Addcond
 
You will not be able to run this command with server side sv_cheats turned off since this is one of those commands that requires sv_cheats to be enabled serverside to work.
You can use this:
http://forums.alliedmods.net/showthread.php?t=92289
to send sv_cheats 1 to a client and see for yourself.

However there is a chance removing addcond's cheat flag would remove its dependency on server side sv_cheats. However this is unlikely since other commands like thirdperson do not lose their dependency.

This is a better way to handle the sv_cheats,
PHP Code:

stock TF2_AddCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^(FCVAR_NOTIFY|FCVAR_REPLICATED));
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"addcond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }
}
stock TF2_RemoveCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^(FCVAR_NOTIFY|FCVAR_REPLICATED));
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"removecond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }


This way the replicated flag is also removed so sv_cheats 1 is never sent to the client and only changed serverside.

WiKer 08-30-2009 10:29

Re: [TF2] Addcond
 
can someone make this like plugin?

pheadxdll 08-30-2009 12:35

Re: [TF2] Addcond
 
EHG: That didn't work the last time I tried it.

naris 09-19-2009 16:38

Re: [TF2] Addcond
 
Quote:

Originally Posted by pheadxdll (Post 918009)
EHG: That didn't work the last time I tried it.

Try this
Code:

SetConVarFlags(cvar, flags^(FCVAR_NOTIFY|FCVAR_REPLICATED));

TheSpyHunter 12-20-2009 17:05

Re: [TF2] Addcond
 
Does anyone new the new conditions since the update? Number 19 Jarate is no longer working.

Old Conditions:

0 = Civilian
1 = Sniper Scope (doesn't zoom in)
2 = Start of Disguise sequence
3 = Disguise (set m_nDisguiseTeam, etc. after applying to select the team/class/player/weapon)
4 = Cloak (only seems to work with Spy)
5 = Uber
6 = Glow from recently using a teleporter
7 = Useless (this is used for when you taunt)
8 = Unknown
9 = Unknown (probably useless since it doesn't alter your condition)
10 = Unknown
11 = Kritz (seems to disable when you kill someone)
12 = Unknown
13 = Unknown (probably useless since it doesn't alter your condition)
14 = Bonk'd (only lasts 5 seconds for Scout; interesting note: if you taunt you stay in third person even with sv_cheats 0)
15 = Useless (this is used for when you are slowed after drinking Bonk and when you're stunned)
16 = Unknown
17 = Useless (this is used for when you are ignited, makes you say fire voice response)
18 = Unknown
19 = Jarate

Wazz 12-20-2009 17:32

Re: [TF2] Addcond
 
I believe there are 2 new ones inserted at around 16 or 17. Hopefully the ones below 16 are the same and those above have just been pushed up by 2. If you can test this for me and get back to us that would be really good!

TheSpyHunter 12-20-2009 18:12

Re: [TF2] Addcond
 
I can confirm 21 did not give/ remove jarate.
Also when I tried stopping a player burning it failed.

Looks like the conditions have changed quite alot...DAMMIT!

Chris-_- 12-20-2009 19:00

Re: [TF2] Addcond
 
Yeah let's e-mail valve and force them to make pretty little generic functions for us :3

Wazz 12-20-2009 20:38

Re: [TF2] Addcond
 
2 Attachment(s)
Feel free to use this extension to watch conditions as they are added to players. The windows signatures will most likely need updating though; Linux symbols should be fine.

TheSpyHunter 12-21-2009 13:14

Re: [TF2] Addcond
 
How does the attached plugin work?

Does it print them to a log/ screen?
Any commands?

Wazz 12-21-2009 13:24

Re: [TF2] Addcond
 
The plugin will print chat messages when someone gains and looses a condition, so just add a bot to the server and test things out on them. There are also the sm_addcondition and sm_removecondition commands but you don't need to use them, you have the method given using sv_cheats/addcond.

I know someone is going to post saying "you don't need an extension to do that". Well, I don't care :)

DontWannaName 12-21-2009 16:08

Re: [TF2] Addcond
 
Is the new bugle mini crit effect a condition? My guess is that it is but just wondering if anyone knows for sure or what number it is?

TheSpyHunter 12-21-2009 17:04

Re: [TF2] Addcond
 
sv_cheats/addcond is how i've been adding it and its been working well.
About to install you mod onto a test server to get the condition numbers.


All times are GMT -4. The time now is 18:44.

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