Другое Weapon Restrict [Forked] 3.1.9 F

Усовершенствованная и упрощенная версия Weapon Restrict

  1. panikajo

    panikajo

    Сообщения:
    389
    Симпатии:
    56
    Держи, добавил csgo_color от Феникса. Допы function.sp и events.sp (csgo_colors.inc)закинуть куда нужно. А weapon_restrict скомпилировать.
    Код:
    #include <sdktools_functions>
    #include <sdktools_entinput>
    #include <weapon_restrict>
    #include <sdkhooks>
    #include <cstrike>
    #include <csgo_colors>
    
    #pragma semicolon 1
    #pragma newdecls required
    
    
    #undef REQUIRE_PLUGIN
    #include <adminmenu>
    
    
    public const char ADMINCOMMANDTAG[] = " \x01[\x04SM\x01]\x04";    // Вынести в перевод
    
    #include "weapon_restrict/defines.sp"
    #include "weapon_restrict/weapons.sp"
    #include "weapon_restrict/cvars.sp"
    #include "weapon_restrict/adminmenu.sp"
    #include "weapon_restrict/perplayer.sp"
    #include "weapon_restrict/weapon-tracking.sp"
    #include "weapon_restrict/events.sp"
    #include "weapon_restrict/admincmds.sp"
    #include "weapon_restrict/functions.sp"
    
    public Plugin myinfo =
    {
        name         =         "Weapon Restrict [FORK]",
        author         =         "Someone & Dr!fter",
        version     =         "3.1.9 F",
        url         =         "http://hlmod.ru/"
    };
    
    
    public APLRes AskPluginLoad2(Handle myself, bool bLate, char[] error, int err_max)
    {
        char gamedir[PLATFORM_MAX_PATH];
        GetGameFolderName(gamedir, sizeof(gamedir));
      
        if(strcmp(gamedir, "cstrike") == 0)    g_iGame = GAME_CSS;
        else if (strcmp(gamedir, "csgo") == 0)
        {
            HEGRENADE_AMMO = 13;
            FLASH_AMMO = 14;
            SMOKE_AMMO = 15;
            g_iMyWeaponsMax = 63;
            g_iGame = GAME_CSGO;
        }
        else
        {
            FormatEx(error, err_max, "[Weapon Resctrict] [ERROR] This plugin is only supported on CS:S or CS:GO.");
            return APLRes_Failure;
        }
    
        g_bLateLoaded = bLate;
      
        hCanBuyForward             =         CreateGlobalForward("Restrict_OnCanBuyWeapon",         ET_Single,         Param_Cell,     Param_Cell,     Param_Cell,     Param_CellByRef        );
        hCanPickupForward         =         CreateGlobalForward("Restrict_OnCanPickupWeapon",     ET_Single,         Param_Cell,     Param_Cell,     Param_Cell,     Param_CellByRef        );
        CreateNative(                                        "Restrict_SetImmunity",            Native_SetImmunity                                                                    );
        CreateNative(                                        "Restrict_SetStatus",            Native_SetStatus                                                                    );
      
        RegPluginLibrary("weapon_restrict");
      
        return APLRes_Success;
    }
    
    public void OnPluginStart()
    { 
        InitWeaponInfoTrie();
        RegisterAdminCommands();
      
        LoadTranslations("common.phrases");
        LoadTranslations("WeaponRestrict.phrases");
      
        AddCommandListener(OnJoinClass,                    "joinclass"                                                                                            );
        HookEvent(                                        "round_start"            ,            EventRoundStart,            EventHookMode_PostNoCopy            );
      
        CreateConVars();
      
        if(LibraryExists("adminmenu"))
        {
            TopMenu hTopMenu =     GetAdminTopMenu();
            if(hTopMenu)        OnAdminMenuReady(hTopMenu);
        }
        RequestFrame(Load);
      
        RegConsoleCmd("sm_wp", CMD_TEST);
    }
    
    public Action CMD_TEST(int iClient, int iArgs)
    {
        for(int i = 1; i < WEAPON_ID_MAX; ++i)    if(i != WEAPON_SHIELD)
        {
            PrintToServer("defaultValuesT  %i", defaultValuesT[i]);
            PrintToServer("defaultValuesCT %i", defaultValuesCT[i]);
        }
        return Plugin_Handled;
    }
    
    Код:
    int GetTypeGroup(const char[] sWeapon)
    {
        for(int i = 0; i < MAXWEAPONGROUPS; ++i)    if(strcmp(sWeapon, g_WeaponGroupNames[i]) == 0)
        {
            return i;
        }
        return WeaponTypeNone;
    }
    
    void CheckConfig()
    {
        char file[PLATFORM_MAX_PATH], szMap[32], pref[6];
      
        GetCurrentMap(szMap, sizeof(szMap));
      
        if (strncmp(szMap, "workshop", 8) == 0)      strcopy(szMap, sizeof(szMap), szMap[8 + StrContains(szMap[9], szMap[8] == '/' ? "/" : "\\")]);
        BuildPath(Path_SM, file, sizeof(file), "configs/restrict/%s.cfg", szMap);
      
        if(!RunFile(file))
        {
            SplitString(szMap, "_", pref, sizeof(pref));
            BuildPath(Path_SM, file, sizeof(file), "configs/restrict/%s_.cfg", pref);
            RunFile(file);
        }
    }
    
    bool RunFile(const char[] sFile)
    {
        if(!FileExists(sFile))    return false;
    
        File FileHandle = OpenFile(sFile, "r");
        char Command[64];
        while(!IsEndOfFile(FileHandle))
        {
            ReadFileLine(FileHandle, Command, sizeof(Command));
            TrimString(Command);
            if(strncmp(Command, "//", 2) != 0 && strlen(Command) != 0)    ServerCommand("%s", Command);
        }
        delete FileHandle;
        return true;
    }
    
    bool IsGoingToPickup(int iClient, int iID)
    {
        int slot = weaponSlots[iID];
      
        if(IsValidWeaponSlot(slot))
        {
            switch(slot)
            {
                case SlotGrenade:
                {
                    int count = Function_GetGrenadeCount(iClient, iID);
                    if(g_iGame != GAME_CSS)
                    {
                        if(((iID == WEAPON_HEGRENADE || iID == WEAPON_SMOKEGRENADE) && count == 0) || (iID == WEAPON_FLASHBANG && count < 2))    return true;
                    }
                    else
                    {
                        if((iID == WEAPON_HEGRENADE && count < g_iHeAmmo) || (iID == WEAPON_SMOKEGRENADE && count < g_iSmokeAmmo) || (iID == WEAPON_FLASHBANG && count < g_iSmokeAmmo))    return true;
                    }
                }
                default:    if(GetPlayerWeaponSlot(iClient, slot) == -1)
                {
                    return true;
                }
            }
        }
        return false;
    }
    
    void ClearOverride()
    {
        for(int i = 1; i < WEAPON_ID_MAX; ++i)
        {
            g_bOverideT[i] = false;
            g_bOverideCT[i] = false;
        }
    }
    
    int GetMaxGrenades()
    {
        if(g_iGame == GAME_CSS)
        {
            return (g_iHeAmmo > g_iFlashAmmo) ? ((g_iHeAmmo > g_iSmokeAmmo) ? g_iHeAmmo:g_iSmokeAmmo):((g_iFlashAmmo > g_iSmokeAmmo) ? g_iFlashAmmo:g_iSmokeAmmo);
        }
        return 2;
    }
    
    bool IsValidWeaponID(int iID)
    {
        if(iID <= WEAPON_NONE || iID >= WEAPON_ID_MAX)    return false;
        return true;
    }
    
    bool IsValidWeaponSlot(int slot)
    {
        if(slot < SlotPrimmary || slot > SlotC4)    return false;
        return true;
    }
    
    void Function_RefundMoney(int iClient, int iID)
    {
        int iAmount = GetWeaponPrice(iClient, iID), iAccount = GetEntProp(iClient, Prop_Send, "m_iAccount");
      
        iAccount += iAmount;
        if(iAccount < g_iMaxMoney)    SetEntProp(iClient, Prop_Send, "m_iAccount", iAccount);
        else                        SetEntProp(iClient, Prop_Send, "m_iAccount", g_iMaxMoney);
    
        CGOPrintToChat(iClient, "%s %t %t", ADMINCOMMANDTAG, "Refunded", iAmount,  weaponNames[iID]);
    }
    
    bool Function_GetImmunity(int iClient)
    {
        return (g_bAdminImmunity && CheckCommandAccess(iClient, "sm_restrict_immunity_level", ADMFLAG_RESERVATION)) || g_bImmunity[iClient];
    }
    
    void Function_RemoveRandom(int count, int iTeam, int iID)
    {
        int[] weaponArray = new int[MAXPLAYERS*GetMaxGrenades()];
        int index, i, gcount, ent, x, z, iClient, slot = weaponSlots[iID];
      
        for(i = 1; i <= MaxClients; ++i)    if(IsClientInGame(i) && !Function_GetImmunity(i) && GetClientTeam(i) == iTeam)
        {
            if(slot == SlotGrenade || iID == WEAPON_TASER || iID == WEAPON_KNIFE || iID == WEAPON_KNIFE_GG)
            {
                if(iID == WEAPON_TASER || iID == WEAPON_KNIFE || iID == WEAPON_KNIFE_GG)        gcount = 1;
                else                                                                        gcount = Function_GetGrenadeCount(i, iID);
              
                for(x = 0; x <= g_iMyWeaponsMax; x++)
                {
                    ent = GetEntPropEnt(i, Prop_Send, "m_hMyWeapons", x);
                    if(ent != -1 && ent && IsValidEdict(ent) && GetWeaponIDFromEnt(ent) == iID)
                    {
                        for(z = 1; z <= gcount; ++z)
                        {
                            weaponArray[index] = ent;
                            ++index;
                        }
                    }
                }
            }
            else if(slot == SlotNone)
            {
                if(Function_HasSpecialItem(i, iID))
                {
                    weaponArray[index] = i;
                    ++index;
                }
            }
            else
            {
                ent = GetPlayerWeaponSlot(i, slot);
                if(ent != -1 && GetWeaponIDFromEnt(ent) == iID)
                {
                    weaponArray[index] = ent;
                    ++index;
                }
            }
        }
        SortIntegers(weaponArray, index-1, Sort_Random);
      
        if(slot == SlotGrenade)
        {
            int ammoindex = -1;
            switch(iID)
            {
                case WEAPON_HEGRENADE:
                {
                    ammoindex = HEGRENADE_AMMO;
                }
                case WEAPON_FLASHBANG:
                {
                    ammoindex = FLASH_AMMO;
                }
                case WEAPON_SMOKEGRENADE:
                {
                    ammoindex = SMOKE_AMMO;
                }
                case WEAPON_INCGRENADE, WEAPON_MOLOTOV:
                {
                    ammoindex = INC_AMMO;
                }
                case WEAPON_DECOY:
                {
                    ammoindex = DECOY_AMMO;
                }
            }
            for(i = 0; i < count; ++i)    if(i <= index-1 && IsValidEdict(weaponArray[i]))
            {
                iClient = GetEntPropEnt(weaponArray[i], Prop_Data, "m_hOwnerEntity");
                if(iClient != -1)
                {
                    gcount = Function_GetGrenadeCount(iClient, iID);
                    switch(gcount)
                    {
                        case 0:    continue;
                        case 1:    if(Function_RemoveWeaponDrop(iClient, weaponArray[i]))
                        {
                            Function_RefundMoney(iClient, iID);
                        }
                        default:
                        {
                            SetEntProp(iClient, Prop_Send, "m_iAmmo", gcount-1, _, ammoindex);
                            Function_RefundMoney(iClient, iID);
                        }
                    }
                }
            }
        }
        else if(slot != SlotNone)
        {
            for(i = 0; i < count; ++i)    if(i <= index-1 && IsValidEdict(weaponArray[i]))
            {
                iClient = GetEntPropEnt(weaponArray[i], Prop_Data, "m_hOwnerEntity");
                if(iClient != -1 && Function_RemoveWeaponDrop(iClient, weaponArray[i]))    Function_RefundMoney(iClient, iID);
            }
        }
        else
        {
            for(i = 0; i < count; ++i)
            {
                if(i > index -1)    break;
              
                if(IsClientInGame(weaponArray[i]) && Function_RemoveSpecialItem(weaponArray[i], iID))    Function_RefundMoney(weaponArray[i], iID);
            }
        }
    }
    
    int Function_GetGrenadeCount(int iClient, int iID)
    {
        int iIndex = -1;
        switch(iID)
        {
            case WEAPON_HEGRENADE:
            {
                iIndex = HEGRENADE_AMMO;
            }
            case WEAPON_FLASHBANG:
            {
                iIndex = FLASH_AMMO;
            }
            case WEAPON_SMOKEGRENADE:
            {
                iIndex = SMOKE_AMMO;
            }
            case WEAPON_INCGRENADE, WEAPON_MOLOTOV:
            {
                iIndex = INC_AMMO;
            }
            case WEAPON_DECOY:
            {
                iIndex = DECOY_AMMO;
            }
            default:
            {
                return ThrowNativeError(SP_ERROR_NATIVE, "Weapon ID %d is not a grenade.", iID);
            }
        }
        return GetEntProp(iClient, Prop_Send, "m_iAmmo", _, iIndex);
    }
    
    int Function_GetTeamWeaponCount(int iTeam, int iID)
    {
        int iWeaponCount, i, slot = weaponSlots[iID];
        for(i = 1; i <= MaxClients; ++i)    if(IsClientInGame(i) && !Function_GetImmunity(i) && GetClientTeam(i) == iTeam)
        {
            switch(slot)
            {
                case SlotGrenade:    iWeaponCount += Function_GetGrenadeCount(i, iID);
                case SlotNone:        if(Function_HasSpecialItem(i, iID))
                {
                    iWeaponCount++;
                }
                default:    if(Function_GetWeaponIDFromSlot(i, slot) == iID)
                {
                    iWeaponCount++;
                }
            }
        }
        return iWeaponCount;
    }
    
    int Function_GetRestrictValue(int iTeam, int iID)
    {
        int iArray;
        switch(iTeam)
        {
            case CS_TEAM_CT:    if(iID != WEAPON_DEFUSER)
            {
                iArray = CvarArrayHandleValCT[iID];
                if(iArray == -1)    return -1;
                return g_hRestrictCVarsCT[iArray].IntValue;
            }
            case CS_TEAM_T:        if(iID != WEAPON_C4)
            {
                iArray = CvarArrayHandleValT[iID];
                if(iArray == -1)    return -1;
                return g_hRestrictCVarsT[iArray].IntValue;
            }
        }
        return -1;
    }
    
    int Function_GetWeaponIDExtended(const char[] sWeapon)
    {
        int iID = GetWeaponID(sWeapon);
        if(iID != WEAPON_NONE)    return iID;
        char sBuffer[32];
        CS_GetTranslatedWeaponAlias(sWeapon, sBuffer, sizeof(sBuffer));
      
        return view_as<int>(CS_AliasToWeaponID(sBuffer));
    }
    
    int Function_GetWeaponIDFromSlot(int iClient, int iSlot)
    {
        int iEnt = GetPlayerWeaponSlot(iClient, iSlot);
        if(iEnt != -1)    return GetWeaponIDFromEnt(iEnt);
        return WEAPON_NONE;
    }
    
    bool Function_HasSpecialItem(int iClient, int iID)
    {
        switch(iID)
        {
            case WEAPON_DEFUSER:         if(GetEntProp(iClient, Prop_Send, "m_bHasDefuser") != 0)
            {
                return true;
            }
            case WEAPON_ASSAULTSUIT:    if(GetEntProp(iClient, Prop_Send, "m_ArmorValue") != 0 && GetEntProp(iClient, Prop_Send, "m_bHasHelmet") != 0)
            {
                return true;
            }
            case WEAPON_KEVLAR:            if(GetEntProp(iClient, Prop_Send, "m_ArmorValue") != 0 && GetEntProp(iClient, Prop_Send, "m_bHasHelmet") == 0)
            {
                return true;
            }
            case WEAPON_NIGHTVISION:    if(GetEntProp(iClient, Prop_Send, "m_bHasNightVision") !=0)
            {
                return true;
            }
        }
        return false;
    }
    
    bool Function_IsWeaponInOverride(int iTeam, int iID)
    {
        switch(iTeam)    // Заменить на if/else после проверки
        {
            case CS_TEAM_CT: if(g_bOverideCT[iID])
            {
                return true;
            }
            case CS_TEAM_T: if(g_bOverideT[iID])
            {
                return true;
            }
        }
        return false;
    }
    
    bool Function_RemoveSpecialItem(int iClient, int iID)
    {
        switch(iID)
        {
            case WEAPON_DEFUSER: if(GetEntProp(iClient, Prop_Send, "m_bHasDefuser") != 0)
            {
                SetEntProp(iClient, Prop_Send, "m_bHasDefuser", 0);
                return true;
            }
            case WEAPON_ASSAULTSUIT:    if(GetEntProp(iClient, Prop_Send, "m_ArmorValue") != 0 && GetEntProp(iClient, Prop_Send, "m_bHasHelmet") != 0)
            {
                SetEntProp(iClient, Prop_Send, "m_ArmorValue", 0);
                SetEntProp(iClient, Prop_Send, "m_bHasHelmet", 0);
                return true;
            }
            case WEAPON_KEVLAR:    if(GetEntProp(iClient, Prop_Send, "m_ArmorValue") != 0 && GetEntProp(iClient, Prop_Send, "m_bHasHelmet") == 0)
            {
                SetEntProp(iClient, Prop_Send, "m_ArmorValue", 0);
                return true;
            }
            case WEAPON_NIGHTVISION:    if(GetEntProp(iClient, Prop_Send, "m_bHasNightVision") !=0)
            {
                SetEntProp(iClient, Prop_Send, "m_bHasNightVision", 0);
                return true;
            }
        }
        return false;
    }
    
    bool Function_RemoveWeaponDrop(int iClient, int iEnt)
    {
        CS_DropWeapon(iClient, iEnt, true, true);
        if(AcceptEntityInput(iEnt, "Kill"))    return true;
        return false;
    }
    
    bool Function_SetRestriction(int iID, int iTeam, int iAmount, bool bOverride)
    {
        if(iAmount < -1)    iAmount = -1;
        int arraycell = -1;
      
        if(iTeam == CS_TEAM_T && iID != WEAPON_DEFUSER)
        {
            arraycell = CvarArrayHandleValT[iID];
            if(arraycell == -1)    return false;
          
            g_hRestrictCVarsT[arraycell].SetInt(iAmount, true);
            if(bOverride)    g_bOverideT[iID] = true;
        }
        else if(iTeam == CS_TEAM_CT && iID != WEAPON_C4)
        {
            arraycell = CvarArrayHandleValCT[iID];
            if(arraycell == -1)    return false;
          
            g_hRestrictCVarsCT[arraycell].SetInt(iAmount, true);
            if(bOverride)    g_bOverideCT[iID] = true;
        }
        return true;
    }
    
    bool Function_SetGroupRestriction(int iGroup, int iTeam, int iAmount)
    {
        for(int i = 1; i < WEAPON_ID_MAX; ++i)    if(iGroup == weaponGroups[i])
        {
            Function_SetRestriction(i, iTeam, iAmount, true);
        }
        return true;
    }
    
    void Function_CheckPlayerWeapons()
    {
        int i, val, count;
        for(i = 1; i < WEAPON_ID_MAX; ++i)    if(i != WEAPON_SHIELD)
        {
            if(i != WEAPON_DEFUSER)
            {
                val = Function_GetRestrictValue(CS_TEAM_T, i);
                if(val == -1)    continue;
              
                count = Function_GetTeamWeaponCount(CS_TEAM_T, i);
                if(count > val)    Function_RemoveRandom(count-val, CS_TEAM_T, i);
            }
            if(i != WEAPON_C4)
            {
                val = Function_GetRestrictValue(CS_TEAM_CT, i);
                if(val == -1)    continue;
              
                count = Function_GetTeamWeaponCount(CS_TEAM_CT, i);
                if(count > val)    Function_RemoveRandom(count-val, CS_TEAM_CT, i);
            }
        }
    }
    
    int Function_CanBuyWeapon(int iClient, int iTeam, int iID)
    {
        int iMaxAmount = Function_GetRestrictValue(iTeam, iID);
        bool bResult = true;
        Action iAction = Plugin_Continue;
    
        Call_StartForward(hCanBuyForward);
        Call_PushCell(iClient);
        Call_PushCell(iTeam);
        Call_PushCell(iID);
        Call_PushCellRef(bResult);
        Call_Finish(iAction);
    
    
        switch(iAction)
        {
            case Plugin_Continue:    if(iMaxAmount == -1 || Function_GetImmunity(iClient) || Function_GetTeamWeaponCount(iTeam, iID) < iMaxAmount || g_bAllow)
            {
                return true;
            }
            case Plugin_Changed:    return bResult;
            default:            return false;
        }
        return false;
    }
    
    bool Function_CanPickupWeapon(int iClient, int iTeam, int iID)
    {
        int iMaxAmount = Function_GetRestrictValue(iTeam, iID);
        bool bResult = true;
        Action iAction = Plugin_Continue;
      
    
        Call_StartForward(hCanPickupForward);
        Call_PushCell(iClient);
        Call_PushCell(iTeam);
        Call_PushCell(iID);
        Call_PushCellRef(bResult);
        Call_Finish(iAction);
    
      
        switch(iAction)
        {
            case Plugin_Continue:    if(iMaxAmount == -1 || Function_GetImmunity(iClient) || Function_GetTeamWeaponCount(iTeam, iID) < iMaxAmount || g_bAllow)
            {
                return true;
            }
            case Plugin_Changed:    return bResult;
            default:                return false;
        }
        return false;
    }
    
    public int Native_SetImmunity(Handle hPlugin, int numParams)
    {
        int iClient = GetNativeCell(1);
        if(IsClientConnected(iClient) && !IsFakeClient(iClient))    g_bImmunity[iClient] = view_as<bool>(GetNativeCell(2));
        else ThrowNativeError(SP_ERROR_NATIVE, "[Weapon Restrict] [ERROR] [SetImmunity] Client '%d' not connected or bot.", iClient);
    }
    
    public int Native_SetStatus(Handle hPlugin, int numParams)
    {
        g_bStatus = GetNativeCell(1);
    }

    public Action OnJoinClass(int iClient, const char[] command, int args)
    {
    CheckPerPlayer();
    return Plugin_Continue;
    }

    public void OnClientPutInServer(int iClient)
    {
    CheckPerPlayer();
    SDKHook(iClient, SDKHook_WeaponCanUse, OnWeaponCanUse);
    }

    public void OnClientDisconnect(int iClient)
    {
    CheckPerPlayer();
    }

    public Action OnWeaponCanUse(int iClient, int iWeapon)
    {
    if(!g_bStatus) return Plugin_Continue;
    static int iTeam, iID;
    iTeam = GetClientTeam(iClient), iID = GetWeaponIDFromEnt(iWeapon);

    if(iID == WEAPON_NONE || Function_CanPickupWeapon(iClient, iTeam, iID) || !IsGoingToPickup(iClient, iID)) return Plugin_Continue;

    if(iID == WEAPON_C4 || iID == WEAPON_KNIFE || g_bWeaponKill) AcceptEntityInput(iWeapon, "Kill");

    if(g_fDelay > 0.0 && !g_bSpamProtectPrint[iClient])
    {
    if(iTeam == CS_TEAM_CT) CGOPrintToChat(iClient, "%s %t %t", ADMINCOMMANDTAG, weaponNames[iID], "IsRestrictedPickupCT", Function_GetRestrictValue(iTeam, iID));
    else CGOPrintToChat(iClient, "%s %t %t", ADMINCOMMANDTAG, weaponNames[iID], "IsRestrictedPickupT", Function_GetRestrictValue(iTeam, iID));
    g_bSpamProtectPrint[iClient] = true;
    CreateTimer(g_fDelay, ResetPrintDelay, iClient);
    }
    return Plugin_Handled;
    }

    public Action ResetPrintDelay(Handle hTimer, int iClient)
    {
    g_bSpamProtectPrint[iClient] = false;
    return Plugin_Stop;
    }

    public void OnMapStart()
    {
    g_bStatus = true;
    ClearOverride();
    CheckWeaponArrays();

    if(g_bLateLoaded)
    {
    for(int i = 1; i <= MaxClients; ++i) if(IsClientInGame(i))
    {
    OnClientPutInServer(i);
    }
    }
    }

    public void OnConfigsExecuted()
    {
    CheckConfig();

    RequestFrame(Load, false);
    }

    public void Load(bool bNothing)
    {
    PerPlayerInit();
    CheckPerPlayer();
    g_bLateLoaded = false;
    }

    public void EventRoundStart(Event hEvent, const char[] name, bool bDontBroadcast)
    {
    Function_CheckPlayerWeapons();
    }

    public Action CS_OnBuyCommand(int iClient, const char[] weapon)
    {
    if(!g_bStatus) return Plugin_Continue;
    static int iTeam, iID;
    iTeam = GetClientTeam(iClient), iID = Function_GetWeaponIDExtended(weapon);

    if(iID == WEAPON_NONE || iID == WEAPON_C4 || iID == WEAPON_SHIELD) return Plugin_Continue;
    if(BuyTeams[iID] != 0 && iTeam != BuyTeams[iID]) return Plugin_Continue;

    if(!Function_CanBuyWeapon(iClient, iTeam, iID))
    {
    if(iTeam == CS_TEAM_CT) PrintToChat(iClient, "%s %t %t", ADMINCOMMANDTAG, weaponNames[iID], "IsRestrictedBuyCT", Function_GetRestrictValue(iTeam, iID));
    else PrintToChat(iClient, "%s %t %t", ADMINCOMMANDTAG, weaponNames[iID], "IsRestrictedBuyT", Function_GetRestrictValue(iTeam, iID));
    return Plugin_Handled;
    }
    return Plugin_Continue;
    }
     

    Вложения:

    yorik59 нравится это.
  2. XAH

    XAH

    Сообщения:
    35
    Симпатии:
    0

    блин , чел, ты супер!!! реал!!! спасибо большое!!!
    но я забыл упомянуть , у меня v34
     
  3. panikajo

    panikajo

    Сообщения:
    389
    Симпатии:
    56
    Тогда тебе поможет @Grey83
     
  4. Grey83

    Grey83 похухоль

    Сообщения:
    2.448
    Симпатии:
    1.269
    @panikajo, а каким тут боком? Я не в курсе какие цвета в v34 работают
    ну кроме \x01 - \x06
     
  5. panikajo

    panikajo

    Сообщения:
    389
    Симпатии:
    56
    Ну ты в css шаришь вроде :)
     
  6. Grey83

    Grey83 похухоль

    Сообщения:
    2.448
    Симпатии:
    1.269
    @panikajo, я с v34 стараюсь не связываться.
    Я вообще с No-Steam версиями игр стараюсь дела не иметь.
     
    Someone и panikajo нравится это.
  7. XAH

    XAH

    Сообщения:
    35
    Симпатии:
    0
    \x01 -\x04
    {default}{green}{lightgreen}{team}
     
  8. bodya

    bodya

    Сообщения:
    157
    Симпатии:
    8
    Кто-нибудь подскажет что делать с этим?

     
  9. -=HellFire=-

    -=HellFire=- Segmentation fault

    Сообщения:
    250
    Симпатии:
    31
    L 01/20/2019 - 16:53:17: [SM] Exception reported: Language phrase "assaultsuit" not found (arg 5)
    L 01/20/2019 - 16:53:17: [SM] Exception reported: Language phrase "kevlar" not found (arg 5)

    А теперь шуруй в переводчик и переводи, дальше думаю сам допрешь :)
     
  10. bodya

    bodya

    Сообщения:
    157
    Симпатии:
    8
    Там не одна ошибка.
     
  11. -=HellFire=-

    -=HellFire=- Segmentation fault

    Сообщения:
    250
    Симпатии:
    31
    Я понимаю :) Но если ты зальешь переводы, то у тебя ошибки с weapon_restrict'om пропадут, ведь в логе только ошибки про этот плагин и указаны
     
  12. Кирилл Шлейко

    Кирилл Шлейко

    Сообщения:
    11
    Симпатии:
    1
    ребят, помогайте, v34, в спец. раунде на ножах и пистолетах, у некоторых игроков не работает ограничение, некоторые бегают с ножами, некоторые с автоматами и пистолетами, и просто ограничить оружие не получается!!!
     
  13. Someone

    Someone Бог из SWGM

    Сообщения:
    1.635
    Симпатии:
    1.010
    Ты плагин попутал, в этом нет спецраундов.
     
  14. ' 「 HOWEN」 .

    ' 「 HOWEN」 .

    Сообщения:
    45
    Симпатии:
    3
    Можешь сделать версию со звуком запрета?
     
  15. ' 「 HOWEN」 .

    ' 「 HOWEN」 .

    Сообщения:
    45
    Симпатии:
    3
    Чет не догоняю.. Раньше все работало нормально, А щас... Пишет, что AWP ограничено до 0.. Но игроки ее берут.. И в начале нового раунда им пишет "Вам возвращено 4700$ за AWP" Ну что то такое... Не подскажете в чем проблема? SM 1.9




    01 "Kicked by Rename" (1.1) by Felya
    02 "SourceMod Anti-Cheat" (0.8.6.4+ <[email protected]>) by Counter-Strike: Source - community «[email protected]»
    03 "SMAC Global" (0.8.6.4+ <[email protected]>) by Counter-Strike: Source - community «[email protected]»
    04 "SMAC Rcon Locker" (0.8.6.4+ <[email protected]>) by Counter-Strike: Source - community «[email protected]»
    05 "SMAC Client Protection" (0.8.6.4+ <[email protected]>) by Counter-Strike: Source - community «[email protected]»
    06 "Client Preferences" (1.9.0.6190) by AlliedModders LLC
    07 "SoDStats" (1.0.12) by ]SoD[ Frostbyte
    08 "[VIP] Grenades" (1.1) by R1KO
    09 "AFK Manager" (3.4.3) by Rothgar
    10 "SteamID Protect" (1.1.1) by SemJeF
    11 "silencenades" (1.1) by grif_ssa
    12 "Offline Ban list" (2.5.6) by Grey & R1KO
    13 "Welcome Sound" (1.0.1) by GoDtm666 (www.MyArena.ru)
    14 "Bot Ping" (1.0.1) by Knagg0
    15 "Basic Comm Control" (1.9.0.6190) by AlliedModders LLC
    16 "Player Commands" (1.9.0.6190) by AlliedModders LLC
    17 "Quake Sounds" (2.7.5) by dalto, Grrrrrrrrrrrrrrrrrrr, psychonic and www.MyArena.ru
    18 "[VIP] AutoBuy" (1.0.0) by R1KO
    19 "Admin File Reader" (1.9.0.6190) by AlliedModders LLC
    20 "om.smx"
    21 "Basic Chat" (1.9.0.6190) by AlliedModders LLC
    22 "Simple Chat Processor (Redux)" (1.1.5) by Simple Plugins, Mini
    23 "Red Terrorist" (1.1) by wS / Schmidt
    24 "[ Menu Creator ]" (2.1) by Reiko1231
    25 "Frags for skin" (1.0) by sahapro33 (Саша Шеин)
    26 "Resurrection (PRIVATE)" (1.0.1) by R1KO
    27 "gameevents_teamcolor.smx"
    28 "Chat 2 VK" (1.1) by XTANCE
    29 "SMAC ConVar Checker" (0.8.6.4+ <[email protected]>) by Counter-Strike: Source - community «[email protected]»
    30 "SM Super Menu" (0.5.0) by pRED* and www.MyArena.ru
    31 "SM Parachute" (2.5.0) by SWAT_88 and www.MyArena.ru
    32 "c4_plant_sound.smx"
    33 "Bomb Events" (1.1) by wS / Schmidt
    34 "[VIP] Voice Sound Player" (28.09.2k17) by Danyas
    35 "[CS] Custom Weapons" (1.1.27) by FrozDark
    36 "[skY]" (2.0) by tale*Quale
    37 "HideMe[Lite]" (3.6) by blodia, LordMarqus, Chocolate and Cheese, Vladislav Dolgov(Elistor), Ws, Vdova
    38 "Point Reklama" (1.2) by 1mpulse (skype: potapovdima1)
    39 "Sound Commands" (1.9.0.6190) by AlliedModders LLC
    40 "Skype Call" (1.0.6) by KOROVKA
    41 "SQL Admin Manager" (1.6.3) by AlliedModders LLC
    42 "Basic Votes" (1.9.0.6190) by AlliedModders LLC
    43 "[SM] Set Tags Clients" (1.1.0) by acik_traiks
    44 "No-Steam Guard Admin Protect" (2.2) by DEN skype cssrs2_ky39i
    45 "Weapon Restrict [FORK]" (3.1.9 F) by Someone & Dr!fter
    46 "MapChooser" (1.6.3) by AlliedModders LLC
    47 "ChangeTeamPlayer | Смена команды игроку" (1.0) by Drumanid
    48 "PARSER" (1.0) by roma
    49 "Basic Commands" (1.9.0.6190) by AlliedModders LLC
    50 "resetscore" (1.0)
    51 "SuperLogs: CSS" (1.0.3) by psychonic
    52 "Anti-Flood" (1.9.0.6190) by AlliedModders LLC
    53 "Radio Spam Block" (1.0.0) by exvel
    54 "Rate Enforcer" (1.2) by TigerOx
    55 "Nextmap" (1.9.0.6190) by AlliedModders LLC
    56 "vk.com/marvel_team_css"
    57 "Toggle listen voice" (1.0.2b) by ilga80|css-rus.ru
    58 "[VIP] Покупка оружия команды" (1.2.1) by Planes
    59 "[VIP] Time VIP" (1.0) by R1KO
    60 "vip/VIP_Fastplant.smx"
    61 "[VIP] Defuser" (1.0.1) by R1KO & T1MOX4
    62 "[VIP] Pets" (1.5) by Someone & Pheonix & Zephyrus
    63 "[VIP] Core" (3.0 R) by R1KO
    64 "[VIP] Vips Online" (1.0.1) by R1KO (skype: vova.andrienko1)
    65 "[VIP] Money" (1.1) by R1KO (skype: vova.andrienko1)
    66 "[VIP] HP" (1.1) by R1KO (skype: vova.andrienko1)
    67 "[VIP] Endurance" (1.0.0) by R1KO (skype: vova.andrienko1)
    68 "[VIP] Damage Change" (1.2) by R1KO
    69 "[VIP] Admin Privileges" (1.0.3) by R1KO
    70 "[VIP]Quiz" (1.3) by DeeperSpy (rework by SHKIPPERBEAST)
    71 "[VIP] Non Lethal Damage" (1.0.0) by Faya (DS: Faya#8514)
    72 "[VIP] Medkit" (1.0) by R1KO
    73 "[VIP] Stats" (2.6) by R1KO
    74 "[VIP] Teammates Heal" (2.0) by 1mpulse & R1KO
    75 "[VIP] CustomWeapons" (1.0.0) by R1KO
    76 "[Gifts] VIP module" (1.2) by asdf & R1KO
    77 "[VIP] Skins (for v34)" (1.0.5 (for v34)) by R1KO (skype: vova.andrienko1)
    78 "[VIP] No Self Damage" (1.0.0) by R1KO (skype: vova.andrienko1)
    79 "vip/VIP_Parachute.smx"
    80 "[VIP] CHAT (+scp)" (3.1.1) by R1KO
    81 "[VIP] Quick Defuse" (1.2) by R1KO
    82 "[VIP] GrenadeTrails" (1.0.2) by R1KO
    83 "Map Config" (1.2.2) by wS
    84 "QuickDefuse" (0.0.3) by pRED* and www.MyArena.ru
    85 "[LR] Module - Overlays" (v2.5.4.1) by RoadSide Romeo
    86 "Say Back to Spector" (1.0.0.2) by GoDtm666
    87 "Assist kill" (v0.0.2) by sahapro33 (Саша Шеин)
    88 "VoteBKM" (1.0.4) by Drumanid
    89 "NoBlock" (1.4.2) by Otstrel.ru Team and www.MyArena.ru
    90 "Losing Team Slayer" (1.3.1) by Lindgren and www.MyArena.ru
    91 "NoSteamGuard" (2.0) by DEN skype cssrs2_ky39i
    92 "Round Start Effect" (1.0) by Parlament
    93 "Admin Help" (1.9.0.6190) by AlliedModders LLC
    94 "Basic Info Triggers" (1.9.0.6190) by AlliedModders LLC
    95 "Advertisements" (0.6.0) by Tsunami
    96 "Rock The Vote" (1.6.3) by AlliedModders LLC
    97 "Advanced c4 Countdown Timer" (1.4.1-rc1) by dalto and www.MyArena.ru
    98 "Default SM Text Replacer" (0.32) by Mitch/Bacardi
    99 "RandomCycle" (1.6.3) by AlliedModders LLC
    100 "Extra Cash" (0.0.2) by Peoples Army
    101 "RoundEndSound" (1.1.2) by GoDtm666 (www.MyArena.ru)
    102 "ms_client.smx"
    103 "Players Votes" (1.5.0) by The Resident, pZv!
    104 "Ignore Grenade Radio" (1.0.0) by GoDtm666 and www.MyArena.ru
    105 "MySteamID" (1.0) by Mopo3
    106 "AdminList" (1.2.4) by Bristwex (for v34 by howen)
    107 "HeadShot Explode" (1.0) by tuty
    108 "Admin Menu" (1.9.0.6190) by AlliedModders LLC
    109 "[Gifts] Core" (3.2) by R1KO
    110 "Fun Votes" (1.9.0.6190) by AlliedModders LLC
    111 "Spray Tracer" (5.8a) by Nican132, CptMoore, Lebson506th
    112 "Knife Kill Admin Skin" (1.0.0) by KOROVKA
    113 "HD" (0.0.4b)
    114 "Reserved Slots" (1.9.0.6190) by AlliedModders LLC
    115 "Map Nominations" (1.6.3) by AlliedModders LLC
    116 "OnPostAdmin_Command" (1.0.0.0) by AlexTheRegent
    117 "SM Super Commands" (0.6.0) by pRED* and www.MyArena.ru
    118 "Weapon_Ban.smx"
    119 "SourceBans" (1.4.9) by SourceBans Development Team
    120 "Observe Client" (1.2.3) by WhiteWolf, puopjik, psychonic
    121 "No Team Falsh" (1.0.0) by GoDtm666
    122 "CrashBan (Private)" by Danyas
    123 "[LR] Core" (v2.5.0) by RoadSide Romeo
    124 "Fun Commands" (1.9.0.6190) by AlliedModders LLC
    125 "AntiFlash Death" (1.2) by miracle (skype: lol_4udo_kek)
     
  16. Big

    Big

    Сообщения:
    171
    Симпатии:
    50
    Как разрешить армор?
    // -1 = unrestricted, 0 = restricted, positive numbers = number allowed for Counter-Terrorists. Weapon:vest
    // -
    // Default: "-1"
    sm_restrict_vest_ct "-1"
    // -1 = unrestricted, 0 = restricted, positive numbers = number allowed for Terrorists . Weapon:vest
    // -
    // Default: "-1"
    sm_restrict_vest_t "-1"
    // -1 = unrestricted, 0 = restricted, positive numbers = number allowed for Counter-Terrorists. Weapon:vesthelm
    // -
    // Default: "-1"
    sm_restrict_vesthelm_ct "-1"
    // -1 = unrestricted, 0 = restricted, positive numbers = number allowed for Counter-Terrorists. Weapon:vesthelm
    // -
    // Default: "-1"
    sm_restrict_vesthelm_ct "-1"
     
  17. ' 「 HOWEN」 .

    ' 「 HOWEN」 .

    Сообщения:
    45
    Симпатии:
    3
    Тебе нужен этот конфиг.. Дальше отредактируй под себя и закинь с заменной
     

    Вложения:

  18. FIVE

    FIVE Developer & Informer

    Сообщения:
    167
    Симпатии:
    124
    Обновил версию до 3.2.0F:
    - Добавлены два оружия MP5-SD и CZ75-AUTO
    - Добавлены фразы для нового оружия в файл перевода
    - Исправлена ошибка:
    Код:
    L 05/06/2019 - 17:39:02: [SM] Blaming: weapon_restrict.smx
    L 05/06/2019 - 17:39:02: [SM] Call stack trace:
    L 05/06/2019 - 17:39:02: [SM]   [1] Line 85, weapon_restrict/events.sp::CS_OnBuyCommand
    L 05/06/2019 - 17:39:57: [SM] Exception reported: Array index out-of-bounds (index 63, limit 55)
    Оффтоп
     

    Вложения:

    Последнее редактирование: 6 май 2019
    Big нравится это.
  19. Kolibri178

    Kolibri178

    Сообщения:
    8
    Симпатии:
    0
    Друзья, огромная просьба помогите узнать причину в log файле ошибку данного плагина Line 85, weapon_restrict/events.sp::CS_OnBuyCommand
     
  20. FIVE

    FIVE Developer & Informer

    Сообщения:
    167
    Симпатии:
    124
    А выше сообщение не читали?