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

Solved CS:GO Help with ConVar sm_awpdeagle 1/0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-14-2018 , 14:00   CS:GO Help with ConVar sm_awpdeagle 1/0
Reply With Quote #1

Hey, i need help with the SourcePawn ConVars, @mug1wara and @micapat helped me out (thanks for that) but i still do not understand it.

Can someone rewrite this Code to Enable/Disenable with sm_awpdeagle 1/0
1 = Round Start, Player spawn with AWP and Deagle
0 = Round Start, Player spawn without AWP but have they own secondary weapon, UPS-S/ P2000 or Glock-18 for the T's.


PHP Code:
#include <sourcemod>
#include <sdkhooks>

public void OnPluginStart()
{
    
HookEvent("round_start"Event_Start);
}

public 
Action Event_Start(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
ServerCommand("mp_ct_default primary weapon_awp");
    
ServerCommand("mp_t_default primary weapon_awp");
    
ServerCommand("mp_ct_default_secondary weapon_deagle");
    
ServerCommand("mp_t_default_secondary weapon_deagle");

Round Start AWP and Deagle Plugin Requested by: TrullSin here the: Theard

Thanks to @mug1wara for this example, but hard to understand it. ^^

Last edited by iskenderkebab33; 11-03-2018 at 17:34.
iskenderkebab33 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-14-2018 , 15:19   Re: CS:GO Help with ConVar sm_awpdeagle 1/0
Reply With Quote #2

Not tested but something like this should work:

PHP Code:
#include <sourcemod>

ConVar gl_hCvarPluginEnabled;
ConVar gl_hCvarCtPrimaryWeapon;
ConVar gl_hCvarCtSecondaryWeapon;
ConVar gl_hCvarTPrimaryWeapon;
ConVar gl_hCvarTSecondaryWeapon;

public 
void OnPluginStart()
{
    
gl_hCvarPluginEnabled CreateConVar("sm_awp_deagle_enabled""1""Enable the plugin");
    
    
gl_hCvarCtPrimaryWeapon   FindConVar("mp_ct_default_primary");
    
gl_hCvarCtSecondaryWeapon FindConVar("mp_ct_default_secondary");
    
gl_hCvarTPrimaryWeapon    FindConVar("mp_t_default_primary");
    
gl_hCvarTSecondaryWeapon  FindConVar("mp_t_default_secondary");
    
    
gl_hCvarPluginEnabled.AddChangeHook(OnCvarChanged);
}

public 
void OnCvarChanged(ConVar hCvarchar[] szOldValuechar[] szNewValue)
{
    if (
StringToInt(szNewValue))
    {
        
gl_hCvarCtPrimaryWeapon.SetString  ("weapon_awp");
        
gl_hCvarCtSecondaryWeapon.SetString("weapon_deagle");
        
gl_hCvarTPrimaryWeapon.SetString   ("weapon_awp");
        
gl_hCvarTSecondaryWeapon.SetString ("weapon_deagle");
    }
    else
    {
        
gl_hCvarCtPrimaryWeapon.SetString  ("");
        
gl_hCvarCtSecondaryWeapon.SetString("weapon_hkp2000");
        
gl_hCvarTPrimaryWeapon.SetString   ("");
        
gl_hCvarTSecondaryWeapon.SetString ("weapon_glock");
    }

The cvar is "sm_awp_deagle_enabled" (1 / 0).
__________________
micapat is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-14-2018 , 16:12   Re: CS:GO Help with ConVar sm_awpdeagle 1/0
Reply With Quote #3

Quote:
Originally Posted by micapat View Post
Not tested but something like this should work:

PHP Code:
#include <sourcemod>

ConVar gl_hCvarPluginEnabled;
ConVar gl_hCvarCtPrimaryWeapon;
ConVar gl_hCvarCtSecondaryWeapon;
ConVar gl_hCvarTPrimaryWeapon;
ConVar gl_hCvarTSecondaryWeapon;

public 
void OnPluginStart()
{
    
gl_hCvarPluginEnabled CreateConVar("sm_awp_deagle_enabled""1""Enable the plugin");
    
    
gl_hCvarCtPrimaryWeapon   FindConVar("mp_ct_default_primary");
    
gl_hCvarCtSecondaryWeapon FindConVar("mp_ct_default_secondary");
    
gl_hCvarTPrimaryWeapon    FindConVar("mp_t_default_primary");
    
gl_hCvarTSecondaryWeapon  FindConVar("mp_t_default_secondary");
    
    
gl_hCvarPluginEnabled.AddChangeHook(OnCvarChanged);
}

public 
void OnCvarChanged(ConVar hCvarchar[] szOldValuechar[] szNewValue)
{
    if (
StringToInt(szNewValue))
    {
        
gl_hCvarCtPrimaryWeapon.SetString  ("weapon_awp");
        
gl_hCvarCtSecondaryWeapon.SetString("weapon_deagle");
        
gl_hCvarTPrimaryWeapon.SetString   ("weapon_awp");
        
gl_hCvarTSecondaryWeapon.SetString ("weapon_deagle");
    }
    else
    {
        
gl_hCvarCtPrimaryWeapon.SetString  ("");
        
gl_hCvarCtSecondaryWeapon.SetString("weapon_hkp2000");
        
gl_hCvarTPrimaryWeapon.SetString   ("");
        
gl_hCvarTSecondaryWeapon.SetString ("weapon_glock");
    }

The cvar is "sm_awp_deagle_enabled" (1 / 0).
many thanks!
iskenderkebab33 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 22:47.


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