AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   My restrict plugin not working :( (https://forums.alliedmods.net/showthread.php?t=300496)

BulgarPL 08-19-2017 06:54

My restrict plugin not working :(
 
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?

brunoronning 08-19-2017 20:05

Re: My restrict plugin not working :(
 
Quote:

Originally Posted by BulgarPL (Post 2542785)
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.

OSWO 08-19-2017 20:07

Re: My restrict plugin not working :(
 
Isn't CS_OnBuyCommand part of <cstrike>? I don't see it being included at the top.

BulgarPL 08-20-2017 10:31

Re: My restrict plugin not working :(
 
Quote:

Originally Posted by OSWO (Post 2542945)
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 :(

Dr!fter 08-20-2017 10:33

Re: My restrict plugin not working :(
 
You have to wait for https://github.com/alliedmodders/sourcemod/pull/659 the update broke a lot of things.

BulgarPL 08-20-2017 13:02

Re: My restrict plugin not working :(
 
Quote:

Originally Posted by Dr!fter (Post 2543069)
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?

klippy 08-20-2017 14:10

Re: My restrict plugin not working :(
 
Quote:

Originally Posted by BulgarPL (Post 2543100)
Where can i download this TempFix?

You will have to build it yourself from that commit if you want it.

asdfxD 08-20-2017 14:28

Re: My restrict plugin not working :(
 
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;




All times are GMT -4. The time now is 09:54.

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