Raised This Month: $32 Target: $400
 8% 

Plugin cvar help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Olaves
Junior Member
Join Date: Apr 2015
Old 04-19-2015 , 10:44   Plugin cvar help
Reply With Quote #1

Hello can anyone help me add a cvar to block using this plugin function from team, like block for red or blue team. Thanks!

#include <sourcemod>
#include <tf2>
#include <tf2attributes>

new Handle:CheckTimers[MAXPLAYERS+1];

public Plugin:myinfo =
{
name = "pluginname",
author = "",
description = "",
version = "1.0",
url = ""
}

new LastUsed[MAXPLAYERS+1];

public OnPluginStart()
{
AddCommandListener(oncallmedic, "voicemenu");

}

public Actionncallmedic(iClient, const String:command[], iArgc)
{
decl String:Cmd1[8], String:Cmd2[8];
GetCmdArg(1, Cmd1, sizeof(Cmd1));
GetCmdArg(2, Cmd2, sizeof(Cmd2));

new i_cmd1 = StringToInt(Cmd1);
new i_cmd2 = StringToInt(Cmd2);
new bool:Access = CheckCommandAccess(iClient, "speedboost", ADMFLAG_RESERVATION);
if(Access)
{
if(i_cmd1==0 && i_cmd2==0 && iClient>0)
{
CheckTimers[iClient] = CreateTimer(10.0, h_reset, iClient);

new currentTime = GetTime();
if (currentTime - LastUsed[iClient] < 25)
{
return Plugin_Handled;
}
LastUsed[iClient] = GetTime();
TF2_AddCondition(iClient, TFCond_SpeedBuffAlly, 10.0);
TF2_AddCondition(iClient, TFCond_MegaHeal, 10.0);
TF2Attrib_SetByName(iClient, "increased jump height", 2.0);

}
}
}

public Action:h_reset(Handle:timer, any:iClient)
{

TF2Attrib_SetByName(iClient, "increased jump height", 1.0);
CheckTimers[iClient] = INVALID_HANDLE;
}
Olaves is offline
Olaves
Junior Member
Join Date: Apr 2015
Old 04-20-2015 , 04:41   Re: Plugin cvar help
Reply With Quote #2

Can anyone help me please!
Olaves is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-20-2015 , 04:57   Re: Plugin cvar help
Reply With Quote #3

Cant read this... Put your code into php tag

[php]
// code
[/php]
KissLick is offline
Olaves
Junior Member
Join Date: Apr 2015
Old 04-20-2015 , 04:59   Re: Plugin cvar help
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <tf2>
#include <tf2attributes>
 
new Handle:CheckTimers[MAXPLAYERS+1];
 
public 
Plugin:myinfo =
{
        
name "pluginname",
        
author "",
        
description "",
        
version "1.0",
        
url ""
}
 
new 
LastUsed[MAXPLAYERS+1];
 
public 
OnPluginStart()
{
        
AddCommandListener(oncallmedic"voicemenu");
       
}
 
public 
Action:oncallmedic(iClient, const String:command[], iArgc)
{
                
decl String:Cmd1[8], String:Cmd2[8];
        
GetCmdArg(1Cmd1sizeof(Cmd1));
                
GetCmdArg(2Cmd2sizeof(Cmd2));
               
                new 
i_cmd1 StringToInt(Cmd1);
                new 
i_cmd2 StringToInt(Cmd2);
                new 
bool:Access CheckCommandAccess(iClient"speedboost"ADMFLAG_RESERVATION);
                if(
Access)
                {
                        if(
i_cmd1==&& i_cmd2==&& iClient>0)
                                {
                                        
CheckTimers[iClient] = CreateTimer(10.0h_resetiClient);
                                                               
                                        new 
currentTime GetTime();
                                        if (
currentTime LastUsed[iClient] < 25)
                                                {
                                                        return 
Plugin_Handled;
                                                }
                                                
LastUsed[iClient] = GetTime();
                                                
TF2_AddCondition(iClientTFCond_SpeedBuffAlly10.0);
                                                
TF2_AddCondition(iClientTFCond_MegaHeal10.0);
                                                
TF2Attrib_SetByName(iClient"increased jump height"2.0);
 
                                }
                }              
}      
 
public 
Action:h_reset(Handle:timerany:iClient)
{
       
        
TF2Attrib_SetByName(iClient"increased jump height"1.0);
        
CheckTimers[iClient] = INVALID_HANDLE;


Last edited by Olaves; 04-20-2015 at 05:04.
Olaves is offline
Olaves
Junior Member
Join Date: Apr 2015
Old 04-21-2015 , 07:37   Re: Plugin cvar help
Reply With Quote #5

So can anyone help me with this, please?
Olaves is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-21-2015 , 09:41   Re: Plugin cvar help
Reply With Quote #6

Here it is (not tested), but next time you should ask in request section and not scripting...

PHP Code:
#include <sourcemod>
#include <tf2>
#include <tf2attributes>

new Handle:CheckTimers[MAXPLAYERS+1];

public 
Plugin:myinfo =
{
    
name "pluginname",
    
author "",
    
description "",
    
version "1.0",
    
url ""
}

new 
LastUsed[MAXPLAYERS+1];
new 
Handle:g_hBlockedTeamg_iBlockedTeam;

public 
OnPluginStart()
{
    
g_hBlockedTeam CreateConVar("sm_cm_blockedteam""2""2 = Red 3, = Blue, -1 = no team is blocked");
    
HookConVarChange(g_hBlockedTeamConVar_Changed);
    
    
AddCommandListener(oncallmedic"voicemenu");
}

public 
OnConfigsExecuted()
{
    
g_iBlockedTeam GetConVarInt(g_hBlockedTeam);
}

public 
ConVar_Changed(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    
g_iBlockedTeam GetConVarInt(g_hBlockedTeam);
}

public 
Action:oncallmedic(iClient, const String:command[], iArgc)
{
    if (
g_iBlockedTeam == GetClientTeam(iClient)) {
        return 
Plugin_Handled;
    }
    
    
decl String:Cmd1[8], String:Cmd2[8];
    
GetCmdArg(1Cmd1sizeof(Cmd1));
    
GetCmdArg(2Cmd2sizeof(Cmd2));

    if (
CheckCommandAccess(iClient"speedboost"ADMFLAG_RESERVATION)) {
        if (
StringToInt(Cmd1) == && StringToInt(Cmd2) == && iClient 0) {
            
CheckTimers[iClient] = CreateTimer(10.0h_resetiClient);

            if (
GetTime() - LastUsed[iClient] < 25) {
                return 
Plugin_Handled;
            }
            
            
LastUsed[iClient] = GetTime();
            
TF2_AddCondition(iClientTFCond_SpeedBuffAlly10.0);
            
TF2_AddCondition(iClientTFCond_MegaHeal10.0);
            
TF2Attrib_SetByName(iClient"increased jump height"2.0);
        }
    }
    
    return 
Plugin_Handled;
}

public 
Action:h_reset(Handle:timerany:iClient)
{
    
TF2Attrib_SetByName(iClient"increased jump height"1.0);
    
CheckTimers[iClient] = INVALID_HANDLE;


Last edited by KissLick; 04-21-2015 at 09:41.
KissLick is offline
Olaves
Junior Member
Join Date: Apr 2015
Old 04-21-2015 , 14:58   Re: Plugin cvar help
Reply With Quote #7

Hey its working and sorry about me making this thread here, and thank you so much for helping me!
Olaves 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 06:23.


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