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

[TF2] Addcond


Post New Thread Reply   
 
Thread Tools Display Modes
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 07-27-2009 , 21:35   Re: [TF2] Addcond
Reply With Quote #11

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.
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-28-2009 , 01:44   Re: [TF2] Addcond
Reply With Quote #12

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?

Last edited by pheadxdll; 07-28-2009 at 02:04.
pheadxdll is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 07-28-2009 , 04:33   Re: [TF2] Addcond
Reply With Quote #13

Quote:
Originally Posted by devicenull View Post
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.
__________________
MikeJS is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-28-2009 , 15:58   Re: [TF2] Addcond
Reply With Quote #14

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).

Last edited by bl4nk; 07-28-2009 at 16:00.
bl4nk is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-28-2009 , 16:06   Re: [TF2] Addcond
Reply With Quote #15

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.

Last edited by pheadxdll; 07-28-2009 at 16:09.
pheadxdll is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 07-28-2009 , 23:56   Re: [TF2] Addcond
Reply With Quote #16

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.
__________________
CrimsonGT is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-29-2009 , 00:16   Re: [TF2] Addcond
Reply With Quote #17

Quote:
Originally Posted by CrimsonGT View Post
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!
pheadxdll is offline
DontWannaName
Veteran Member
Join Date: Jun 2007
Location: VALVe Land, WA
Old 07-29-2009 , 02:10   Re: [TF2] Addcond
Reply With Quote #18

and knowing is half the battle!
__________________

DontWannaName is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-29-2009 , 04:51   Re: [TF2] Addcond
Reply With Quote #19

Much to my surprise, I got it working via an MM:S plugin. 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.
pheadxdll is offline
Chris-_-
SourceMod Donor
Join Date: Oct 2008
Old 07-29-2009 , 17:18   Re: [TF2] Addcond
Reply With Quote #20

Care to post an extension providing the native for plugins? *anyone*
Chris-_- 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 10:44.


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