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

My restrict plugin not working :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BulgarPL
Member
Join Date: Dec 2015
Old 08-19-2017 , 06:54   My restrict plugin not working :(
Reply With Quote #1

Quote:
#pragma semicolon 1
#include <sourcemod>
#include <colors>

public Plugin:myinfo ={
name = "Blokada Broni",
author = "Raflik",
description = "",
version = "1.0",
url = "Cs-NaBani.pl"
};

public Action:CS_OnBuyCommand(client, const String:weapon[]){
if(StrEqual(weapon, "m4a1", false) || StrEqual(weapon, "m4a1_silencer", false) || StrEqual(weapon, "revolver", false) || StrEqual(weapon, "usp_silencer", false) || StrEqual(weapon, "hkp2000", false) || StrEqual(weapon, "cz75a", false) || StrEqual(weapon, "ak47", false) || StrEqual(weapon, "aug", false) || StrEqual(weapon, "awp", false) || StrEqual(weapon, "bizon", false) || StrEqual(weapon, "deagle", false) || StrEqual(weapon, "elite", false) || StrEqual(weapon, "famas", false) || StrEqual(weapon, "fiveseven", false) || StrEqual(weapon, "G3SG1", false) || StrEqual(weapon, "galilar", false) || StrEqual(weapon, "glock", false) || StrEqual(weapon, "m249", false) || StrEqual(weapon, "mac10", false) || StrEqual(weapon, "mag7", false) || StrEqual(weapon, "mp7", false) || StrEqual(weapon, "mp9", false) || StrEqual(weapon, "negev", false) || StrEqual(weapon, "nova", false) || StrEqual(weapon, "p90", false) || StrEqual(weapon, "p250", false) || StrEqual(weapon, "sawedoff", false) || StrEqual(weapon, "scar20", false) || StrEqual(weapon, "sg556", false) || StrEqual(weapon, "ssg08", false) || StrEqual(weapon, "taser", false) || StrEqual(weapon, "tec9", false) || StrEqual(weapon, "ump45", false) || StrEqual(weapon, "xm1014", false)){
PrintToChat(client, "\x01[\x04NaBani\x01] \x02Bronie sa przypisane do klas!");
return Plugin_Handled;
}
return Plugin_Continue;
}
But players can still buy after the last update (SM 6022).
How can i fix it?
BulgarPL is offline
brunoronning
Senior Member
Join Date: Jan 2014
Location: Brazil
Old 08-19-2017 , 20:05   Re: My restrict plugin not working :(
Reply With Quote #2

Quote:
Originally Posted by BulgarPL View Post
But players can still buy after the last update (SM 6022).
How can i fix it?
Do you want players to only buy a specific weapon or want to block everything? Explain.
brunoronning is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 08-19-2017 , 20:07   Re: My restrict plugin not working :(
Reply With Quote #3

Isn't CS_OnBuyCommand part of <cstrike>? I don't see it being included at the top.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-20-2017 , 10:31   Re: My restrict plugin not working :(
Reply With Quote #4

Quote:
Originally Posted by OSWO View Post
Isn't CS_OnBuyCommand part of <cstrike>? I don't see it being included at the top.
Added cstrike, stil the same problem. Players can buy, this plugin was workin before update
BulgarPL is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-20-2017 , 10:33   Re: My restrict plugin not working :(
Reply With Quote #5

You have to wait for https://github.com/alliedmodders/sourcemod/pull/659 the update broke a lot of things.
Dr!fter is offline
BulgarPL
Member
Join Date: Dec 2015
Old 08-20-2017 , 13:02   Re: My restrict plugin not working :(
Reply With Quote #6

Quote:
Originally Posted by Dr!fter View Post
You have to wait for https://github.com/alliedmodders/sourcemod/pull/659 the update broke a lot of things.
Where can i download this TempFix?
BulgarPL is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-20-2017 , 14:10   Re: My restrict plugin not working :(
Reply With Quote #7

Quote:
Originally Posted by BulgarPL View Post
Where can i download this TempFix?
You will have to build it yourself from that commit if you want it.
klippy is offline
asdfxD
Veteran Member
Join Date: Apr 2011
Old 08-20-2017 , 14:28   Re: My restrict plugin not working :(
Reply With Quote #8

works with sm 6024 but spams error messages in log.

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

#pragma semicolon 1
#pragma newdecls required

bool PlayerIsAdmin[MAXPLAYERS+1];

public 
void OnClientPostAdminCheck(int client)
{
    
PlayerIsAdmin[client] = CheckCommandAccess(client"allow_admin_weapon"ADMFLAG_ROOT);
    
SDKHook(clientSDKHook_WeaponCanUseOnWeaponCanUse);
}

public 
void OnClientDisconnect(int client)
{
    
SDKUnhook(clientSDKHook_WeaponCanUseOnWeaponCanUse);
}

public 
Action CS_OnBuyCommand(int client, const char[] weapon)
{
    if (!
IsClientInGame(client) || GetClientTeam(client) <= 1)
    {
        return 
Plugin_Continue;
    }

    if (!
PlayerCanUseWeapon(clientweapon))
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;
}

bool PlayerCanUseWeapon(int client, const char[] weapon)
{
    if (
StrEqual("weapon_g3sg1"weaponfalse) || (StrEqual("weapon_scar20"weaponfalse) && !PlayerIsAdmin[client]))
    {
        return 
false;
    }
    
    return 
true;
}

public 
Action OnWeaponCanUse(int clientint weapon)
{
    
char g_sWeapon[50];
    
GetEntityClassname(weapong_sWeaponsizeof(g_sWeapon));    
    
    if (!
PlayerCanUseWeapon(clientg_sWeapon))
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Last edited by asdfxD; 08-20-2017 at 14:34.
asdfxD 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 08:47.


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