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

[CSGO] 2 Questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 04-13-2017 , 10:30   [CSGO] 2 Questions
Reply With Quote #1

Hi
I have 2 questions
1. I wan't make #1 code for admin only but i dont know how toAny Ideas?
2. How can i disable stats and status in #2 code for admin_root?
PTaH
#1
PHP Code:
#pragma semicolon 1
#include <PTaH>
#include <sourcemod>

public void OnPluginStart() 
{
    
PTaH(PTaH_WeaponCanUseHookWeaponCanUse);
}

public 
bool WeaponCanUse(int iClientint iEntbool CanUse)
{
    static 
char sClassname[64];
    
GetEdictClassname(iEntsClassnamesizeof(sClassname));
    if(
StrEqual(sClassname"weapon_c4")) return true;
    return 
CanUse;
}

if (
CheckAdminFlags(clientADMFLAG_ROOT))
{


#2
PHP Code:
#pragma semicolon 1
#include <PTaH>

public Plugin myinfo =
{
    
name "Bla bla",
    
author "",
    
version "",
    
url ""
};

public 
void OnPluginStart()
{
    
PTaH(PTaH_ExecuteStringCommandHookExecuteStringCommand);
}

public 
Action ExecuteStringCommand(int iClientchar sCommand[512])
{
    if(
StrContains(sCommand"stats") != -&& StrContains(sCommand"status") != -1)
    {
        
PrintToConsole(iClient"Unknown command: %s"sCommand);
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;


Last edited by Sw33T3R; 04-13-2017 at 12:49.
Sw33T3R is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 04-13-2017 , 11:23   Re: [CSGO] 2 Questions
Reply With Quote #2

You better remove #2, before mods do.

As for #1, take a look at function CheckCommandAccess.
__________________
xines is offline
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 04-13-2017 , 13:20   Re: [CSGO] 2 Questions
Reply With Quote #3

@UP Thanks for advice!
My plugin works but everyone who have ADMFLAG_ROOT can pickup C4
I dont want it
For Example:
PHP Code:
If X root enabled c4 pickuping as CT
Y ROOT can
't pickup as CT if he dont used !c4on 
PHP Code:
#include <PTaH>
#include <sourcemod>
#include <cstrike>

public Plugin:myinfo =
{
    
name "C4 Troll",
    
author "Nevvy",
    
description "As ADMFLAG_ROOT you can pick C4",
    
version "",
    
url ""
};

public 
void OnPluginStart() 
{
    
RegConsoleCmd("sm_c4on"on);
    
RegConsoleCmd("sm_c4off"off);
}

public 
Action:on(clientargs)
{
    if(
client != && !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }

    if(
CheckCommandAccess(client"c4"ADMFLAG_ROOT))
    {
        
PrintToChat(client"[SM] C4 Pickuping is ENABLED");
        
PTaH(PTaH_WeaponCanUseHookWeaponCanUse);
    }
    else
    {
        
PrintToChat(client"[SM] You don't have permissions to this command.");
    }

    return 
Plugin_Handled;
}

public 
Action:off(clientargs)
{
    if(
client != && !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }

    if(
CheckCommandAccess(client"c4"ADMFLAG_ROOT))
    {
        
PrintToChat(client"[SM] C4 Pickuping is DISABLED");
        
PTaH(PTaH_WeaponCanUseUnHookWeaponCanUse);
    }
    else
    {
        
PrintToChat(client"[SM] You don't have permissions to this command.");
    }

    return 
Plugin_Handled;
}

public 
bool WeaponCanUse(int clientint iEntbool CanUse)
{
    if(
GetClientTeam(client) == CS_TEAM_T)
    {
        static 
char sClassname[64];
        
GetEdictClassname(iEntsClassnamesizeof(sClassname));
        if(
StrEqual(sClassname"weapon_c4"))
        {
            return 
true;
        }
        return 
CanUse;
    }
    
    if(
CheckCommandAccess(client"c4"ADMFLAG_ROOT) && (GetClientTeam(client) == CS_TEAM_CT))
    {
        static 
char sClassname[64];
        
GetEdictClassname(iEntsClassnamesizeof(sClassname));
        if(
StrEqual(sClassname"weapon_c4"))
        {
            return 
true;
        }
        return 
CanUse;
    }
    
    static 
char sClassname[64];
    
GetEdictClassname(iEntsClassnamesizeof(sClassname));
    if(
StrEqual(sClassname"weapon_c4"))
    {
        return 
false;
    }
    return 
CanUse;

Sw33T3R is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 04-13-2017 , 14:10   Re: [CSGO] 2 Questions
Reply With Quote #4

I dont have anymore time, but try something like this:

PHP Code:
#include <PTaH> 
#include <sourcemod> 
#include <cstrike> 

bool CanUseBomb[MAXPLAYERS+1];

public 
Plugin myinfo 

    
name "C4 Troll"
    
author "Nevvy"
    
description "As ADMFLAG_ROOT you can pick C4"
    
version ""
    
url "" 
}; 

public 
void OnPluginStart()

    
RegConsoleCmd("sm_c4on"on); 
    
RegConsoleCmd("sm_c4off"off); 
}

public 
Action on(int clientint args)
{
    if(
IsValidClient(client))
    {
        if(
CheckCommandAccess(client"c4"ADMFLAG_ROOTtrue))
        {
            
CanUseBomb[client] = true;
            
PrintToChat(client"[SM] C4 Pickuping is ENABLED");
            
PTaH(PTaH_WeaponCanUseHookWeaponCanUse);
        }
        else
        {
            
CanUseBomb[client] = false;
            
PrintToChat(client"[SM] You don't have permissions to this command."); 
        }
    }
    return 
Plugin_Handled


public 
Action off(int clientint args

    if(
IsValidClient(client))
    {
        if(
CheckCommandAccess(client"c4"ADMFLAG_ROOTtrue)) 
        { 
            
PrintToChat(client"[SM] C4 Pickuping is DISABLED"); 
            
PTaH(PTaH_WeaponCanUseUnHookWeaponCanUse); 
        } 
        else 
        { 
            
PrintToChat(client"[SM] You don't have permissions to this command."); 
        }
        
        
CanUseBomb[client] = false;
    }
    return 
Plugin_Handled


public 
bool WeaponCanUse(int clientint iEntbool CanUse
{
    static 
char sClassname[64]; 
    
GetEdictClassname(iEntsClassnamesizeof(sClassname));
    if(
StrEqual(sClassname"weapon_c4") && GetClientTeam(client) == CS_TEAM_CT
    {
        if(
IsValidClient(client) && CanUseBomb[client]) return true;
        else return 
false;
    }
    else return 
true;
    
    return 
CanUse;
}

/** Stocks **/
stock bool IsValidClient(int client)
{
    return (
<= client <= MaxClients && IsClientInGame(client));

__________________

Last edited by xines; 04-13-2017 at 14:10.
xines is offline
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 04-24-2017 , 05:04   Re: [CSGO] 2 Questions
Reply With Quote #5

Quote:
Originally Posted by xines View Post
I dont have anymore time, but try something like this:
...snip...
Thanks for help
Sw33T3R 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 09:02.


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