Индувидуалный запрет оружие

bake2

Пользователь
Регистрация
3 Окт 2019
Сообщения
169
Симпатии
4
OS
Linux
Amx Mod X
AMXX 1.9.0
Билд
Set to 1 if player joins a team before authorizing with steam.
ReGamedll
ReGameDLL version: 5.20.0.492-dev Build date: 15:26:35 Jan 4 2021
Metamod
Metamod-r v1.3.0.128, API (5:13) Metamod-r build: 17:47:54 Aug 24 2018
Meta модули
Код:
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Плагины
Код:
[  1] Admin Base              1.9.0.5271  AMXX Dev Team     admin.amxx       running  
 [  2] FreshBans               1.3.8b      kanagava          fresh_bans.amxx  running  
 [  3] Chat Manager            1.1.2-16    Mistrick          chatmanager.amx  running  
 [  4] Chat Manager: Addon     0.0.4-70    Mistrick          chatmanager_add  running  
 [  5] Admin Commands          1.9.0.5271  AMXX Dev Team     admincmd.amxx    running  
 [  6] Commands Menu           1.9.0.5271  AMXX Dev Team     cmdmenu.amxx     running  
 [  7] Server Menu             1.5.0       F@nt0M            server_menu.amx  running  
 [  8] Players Menu            1.7         neugomon          plmenu.amxx      debug    
[  9] Maps Menu               1.4.1       neugomon          mapsmenu.amxx    running  
 [ 10] Plugin Menu             1.9.0.5271  AMXX Dev Team     pluginmenu.amxx  running  
 [ 11] Admin Chat              1.9.0.5271  AMXX Dev Team     adminchat.amxx   running  
 [ 12] Instant AutoTeamBalanc  1.2.0       ConnorMcLeod      autoteambalance  running  
 [ 13] CSStatsX SQL            0.7.4+2     serfreeman1337    csstatsx_sql.am  running  
 [ 14] AES: StatsX             0.5.9 [REA  serfreeman1337/s  aes_statsx_cstr  running  
 [ 15] Stats Configuration     1.9.0.5271  AMXX Dev Team     statscfg.amxx    running  
 [ 16] Restrict Weapons        1.9.0.5271  AMXX Dev Team     restmenu.amxx    running  
 [ 17] StatsX                  1.9.0.5271  AMXX Dev Team     statsx.amxx      running  
 [ 18] Reklama                 20.05.2020  mx?!              reklama.amxx     running  
 [ 19] Advanced Kill Assists   1.2d        Xelson            next21_kill_ass  running  
 [ 20] VoteGag                 1.0         sNk               votegag.amxx     running  
 [ 21] [190] SlayLosers RBS    20.06.06    SKAJIbnEJIb & d3  slaylosers_rbs.  running  
 [ 22] Mode 2x2                2.5re       s1lent            mode.amxx        running  
 [ 23] mute menu               1.0         cheap_suit        mutemenu.amxx    running  
 [ 24] Rock to Ban             1.02        Safety1st         rock2ban.amxx    running  
 [ 25] AFK Control             1.4.1 [Rnd  neygomon          afk_control.amx  running  
 [ 26] Reset_Score             1.0         FBR               resetscore.amxx  running  
 [ 27] Ping Faker              1.5a        MeRcyLeZZ         pingfaker.amxx   running  
 [ 28] COLORS MENU             1.2         DUKKHAZ0R         color.amxx       running  
 [ 29] Nice Killer             1.6         Got Milk? / HoHo  nice_killer.amx  running  
 [ 30] WeaponState Remember    0.0.4       Vaqtincha         weaponstate_rem  running  
 [ 31] GameName Changer        1.0         neugomon          gamename_change  running  
 [ 32] C4 Timer                1.1         SAMURAI & Remod:  c4_timer.amxx    running  
 [ 33] [190] VIP RBS           20.07.20    SKAJIbnEJIb       vip_rbs.amxx     running  
 [ 34] [190] First Players Re  20.06.06    SKAJIbnEJIb       FirstPlayersRes  running  
 [ 35] Top Awards              0.11c       Safety1st         top_awards4.amx  running  
 [ 36] Auto-ResetScore         1.0         maeStro           autorr.amxx      running  
 [ 37] Time for info           1.0         neugomon          time_for_info.a  running  
 [ 38] Weapon Icon             1.2         hoboman313/Zenix  weapon_icon.amx  running  
 [ 39] Combo On Kill           0.2         Vaqtincha         combo_on_kill.a  running  
 [ 40] AES: Status Info        0.1         serfreeman1337    aes_status_info  running  
 [ 41] AES: StatsX Info Rank   0.1         serfreeman1337    aes_statsx_rank  running  
 [ 42] Center Msg Fix          0.4         mx?!              CenterMsgFix.am  running  
 [ 43] Knife WarnUP            1.0         ill               knife_warm-up.a  running  
 [ 44] Refill Weapon On Kill   0.0.1a      Vaqtincha         refill_weapon_o  running  
 [ 45] Smoke: HealthNade       0.0.3       wopox1337         Smoke_HealthNad  running  
 [ 46] AdminsOnline            1.0         ZETA [M|E|N]      AdminsOnline.am  running  
 [ 47] Advanced Ultimate Weap  0.1.0b      steelzzz          auw.amxx         running  
 [ 48] [ReAPI] Auto Menu       0.1.644     CG                automenu_with_a  running  
 [ 49] Auto-Give Privileges    1.0         SerGrib           nightvip.amxx    running  
 [ 50] VoteMap After Round Li  1.0         neygomon          votemap_after_w  running  
 [ 51] Simple Damager          2.1.0       fl0wer            simple_damager.  running  
 [ 52] Demo Recorder           2.4.1       F@nt0M            demo_recorder.a  running  
 [ 53] Parachute for ALL [ReA  3.0         Leo_[BH]          parachute.amxx   running  
 [ 54] NO_FITH_TEXT            1.1w        perf              No_fith_text.am  running  
 [ 55] No Bhop and SGS/DDRun   1.1         Denzer            no_bhop_sgs.amx  running  
 [ 56] BlockReconnectRespawn   1.4-kill    Sylwester         brr_kill.amxx    running  
 [ 57] Goomba Stomp            2.0.1       OciXCrom          crx_goomba_stom  running  
 [ 58] Win Messages & Sounds   2.2         OciXCrom          crx_winmessages  running  
 [ 59] [ReAPI:AMXX] Buy Nades  0.0.3a      steelzorrr        amxx_buy_nades_  running  
 [ 60] [190] No Team Flash     20.06.06    SKAJIbnEJIb       NoTeamFlash.amx  running  
 [ 61] SF Bets                 0.1.5       serfreeman1337    sf_bets.amxx     running  
 [ 62] Spect Bot               1.2         SKAJIbnEJIb & Bo  SpectBot.amxx    running  
 [ 63] Bomb pickup on use      1.0.1       voed              use_bomb_pickup  running  
 [ 64] [190] Snipers RBS       20.06.06    SKAJIbnEJIb       snipers_rbs.amx  running  
 [ 65] Give HP                 1.0         neygomon | 9art   vampire.amxx     running  
 [ 66] Map Manager: Core       3.0.7       Mistrick          map_manager_cor  running  
 [ 67] Map Manager: Scheduler  0.1.5       Mistrick          map_manager_sch  running  
 [ 68] Map Manager: Rtv        0.1.1       Mistrick          map_manager_rtv  running  
 [ 69] Map Manager: Nominatio  0.1.2       Mistrick          map_manager_nom  running  
 [ 70] Map Manager: BlockList  0.0.3       Mistrick          map_manager_blo  running  
 [ 71] Map Manager: Online so  0.0.2       Mistrick          map_manager_onl  running  
 [ 72] Map Manager: Effects    0.0.9       Mistrick          map_manager_eff  running  
 [ 73] Map Manager: Informer   0.0.5       Mistrick          map_manager_inf  running  
 [ 74] Map Manager: Advanced   0.0.5       Mistrick          map_manager_adv  running  
 [ 75] Advanced Experience Sy  0.5.9 [REA  serfreeman1337/s  aes_main.amxx    running  
 [ 76] AES: CStrike Addon      0.5.9 [REA  serfreeman1337/s  aes_exp_cstrike  running  
 [ 77] AES: Informer           0.5.9 [REA  serfreeman1337/s  aes_informer.am  running  
 [ 78] AES: Admin Tools        0.5.9 [REA  serfreeman1337/s  aes_exp_editor.  running  
 [ 79] Custom Player Models A  0.2.1       F@nt0M & BlackSi  custom_player_m  running  
 [ 80] Custom Player Models C  0.2.1       BlackSignature    custom_player_m  running  
 [ 81] ChatAdditions: Core     v1.4.1      Sergey Shorokhov  ChatAdditions_C  running  
 [ 82] ChatAdditions: SQLite   v1.4.1      Sergey Shorokhov  CA_Storage_SQLi  running  
 [ 83] CA: Gag                 v1.4.1      Sergey Shorokhov  CA_Gag.amxx      running
Amxx Модули
Код:
MySQL                   1.9.0.5271  AMX Mod X Dev Team   running    
SQLite                  1.9.0.5271  AMX Mod X Dev Team   running    
Fun                     1.9.0.5271  AMX Mod X Dev Team   running    
Engine                  1.9.0.5271  AMX Mod X Dev Team   running    
FakeMeta                1.9.0.5271  AMX Mod X Dev Team   running    
GeoIP                   1.9.0.5271  AMX Mod X Dev Team   running    
nVault                  1.9.0.5271  AMX Mod X Dev Team   running    
CStrike                 1.9.0.5271  AMX Mod X Dev Team   running    
CSX                     1.9.0.5271  AMX Mod X Dev Team   running    
Ham Sandwich            1.9.0.5271  AMX Mod X Dev Team   running    
ReAPI                   5.19.0.211  Asmodai & s1lent     running    
Sockets                 1.9.0.5271  AMX Mod X Dev Team   running    
RegEx                   1.9.0.5271  AMX Mod X Dev Team   running    
Sockets2                1.8.1.3746  HLSW Dev Team        running
Ошибка
Код:
Запрет оружие скидывается после смены карты.
Исходник
Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <nvault>

#define PLUGIN    "Individual Weapon Restrictions"
#define VERSION    "0.5"
#define AUTHOR    "bugsy"

#pragma semicolon 1

new g_NvID;            //nVault handle
new g_Restrictions[33];        //Weapon restrictions for players [bit-field]
new g_JoinedBeforeAuth[33];    //Set to 1 if player joins a team before authorizing with steam.
new g_Authorized[33];        //Set to 1 when authorizes.
new Float:g_fMsgDelay[33];    //To prevent flooding with client_print on weapon purchases
new iSaid[33];

new g_MaxClients;           
new g_MsgMoney;

//Ham\FM Forward handles
new HamHook:g_HamAddPlayerItem;
new g_FMTouch;
new g_ForwardsEnabled = 1;

//Weapon Priority Switching [ven]
#define WEAPONS    29
new const WEAPON_PRIORITY[WEAPONS] = {3, 5, 7, 8, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 30, 1, 10, 11, 16, 17, 26, 6, 4, 9, 25, 29};

//Fakemeta
#define IsPlayer(%1)  ( 1 <= %1 <= g_MaxClients )

#define OFFSET_AMMO_LINUXDIFF    5
#define EXTRAOFFSET_WEAPONS    4 
#define OFFSET_WEAPONTYPE    43 
#define OFFSET_CSMONEY        115
#define OFFSET_FLASH_AMMO    387
#define OFFSET_HE_AMMO        388
#define OFFSET_SMOKE_AMMO    389

new const g_WeaponPrice[33] = 
{
    0,    
    600,
    0,   
    2750, 
    300,  
    3000, 
    0, 
    1400, 
    3500, 
    300, 
    1000,  
    750, 
    1700, 
    4200, 
    2000, 
    2250, 
    500, 
    400, 
    4750, 
    1500, 
    5750, 
    1700, 
    3100, 
    1250, 
    5000, 
    200,    
    650,  
    3500, 
    2500, 
    0,    
    2350, 
    0,    
    0 };

new const g_WeaponNames[33][] = 
{
    "",
    "p228",
    "",
    "scout",
    "hegrenade",
    "xm1014",
    "",
    "mac10",
    "aug",
    "smokegrenade",
    "elite",
    "fiveseven",
    "ump45",
    "sg550",
    "galil",
    "famas",
    "usp",
    "glock18",
    "awp",
    "mp5navy",
    "m249",
    "m3",
    "m4a1",
    "tmp",
    "g3sg1",
    "flashbang",
    "deagle",
    "sg552",
    "ak47",
    "",
    "p90",
    "",
    ""};

public plugin_init() 
{
    register_plugin( PLUGIN , VERSION , AUTHOR );
    register_cvar("iwr_plugin" , VERSION , FCVAR_SERVER );
                                
    register_concmd( "amx_restrictadd" , "AddRestrict" , ADMIN_BAN , "- <player> <weapon> - Add weapon restriction to player." );
    register_concmd( "amx_restrictremove" ,"RemoveRestrict" , ADMIN_BAN ,  "- <player> <weapon> - Remove weapon restriction to player." );
    register_concmd( "amx_restrictclear" , "ClearRestrict" , ADMIN_BAN ,  "- <player> - Clear all weapon restrictions for player." );
    register_concmd( "amx_restrictshow" , "ShowRestrict" , ADMIN_BAN ,  "- <player> - Display a players weapon restrictions." );
    register_clcmd( "say /restrict" , "NotifyPlayer" , ADMIN_ALL , "- Display your weapon restrictions" );
                                                                          
    register_event( "TextMsg" , "PlayerJoinedTeam" , "a" , "2=#Game_join_terrorist" , "2=#Game_join_ct" );
    
    g_HamAddPlayerItem = RegisterHam( Ham_AddPlayerItem ,"player" ,"fw_AddPlayerItem" );
    g_FMTouch = register_forward( FM_Touch, "fw_Touch" );
    
    g_MaxClients = global_get( glb_maxClients );
    g_MsgMoney = get_user_msgid( "Money" );

    g_NvID = nvault_open( "iwr_data" );

    if ( g_NvID == INVALID_HANDLE ) 
        set_fail_state( "Error opening nvault" );
}

public plugin_end()
{
    nvault_close( g_NvID );
}

public client_putinserver(id)
{
    if( is_user_bot(id) )
        return PLUGIN_CONTINUE;

    new szAuthID[35];
    new szKey[13];                                                                 
    new tmp;
                                               
    get_user_authid( id , steamid , 34 );    
        
    //Check vault for restriction entry and, if found, set # to g_Restrictions[]
    if ( nvault_lookup( g_NvID , szAuthID , szKey , 12 ,  tmp ) )
    {
        g_Restrictions[id] = str_to_num(szKey);
                
        if( g_JoinedBeforeAuth[id] )
            NotifyPlayer(id);    
            
        CheckForwards();
    }
    
    iSaid[id] = 0;
    g_Authorized[id] = 1;

    return PLUGIN_CONTINUE;
}

public client_disconnect(id)
{
    if ( is_user_bot(id) )
        return PLUGIN_CONTINUE;

    g_Authorized[id] = 0;
    g_JoinedBeforeAuth[id] = 0;
    g_Restrictions[id] = 0;

    CheckForwards();

    return PLUGIN_CONTINUE;
}

public CheckForwards()
{
    new iPlayers[32];
    new iPlayersNum;
    get_players( iPlayers, iPlayersNum, "c" );
    
    for ( new i = 0; i < iPlayersNum; i++ )
    {
        if ( g_Restrictions[iPlayers] )
        {
            if ( !g_ForwardsEnabled )
            {
                EnableHamForward( g_HamAddPlayerItem );
                g_FMTouch = register_forward( FM_Touch, "fw_Touch" );
                g_ForwardsEnabled = 1;
            }
            return PLUGIN_HANDLED;
        }
    }

    DisableHamForward( g_HamAddPlayerItem );
    unregister_forward( FM_Touch, g_FMTouch );
    g_ForwardsEnabled = 0;
    
    return PLUGIN_HANDLED;
}

public PlayerJoinedTeam()
{
    new szName[33];
    read_data ( 3 , szName , 32 );
    new id = get_user_index ( szName );
    
    if ( is_user_bot(id) )
        return PLUGIN_CONTINUE;
    
    if ( !g_Authorized[id] )
    {
        g_JoinedBeforeAuth[id] = 1;
    }
    else 
    {
        if ( g_Restrictions[id] )
            NotifyPlayer(id);
    }

    return PLUGIN_CONTINUE;
}

public NotifyPlayer(id)
{
    static szHUD[256];
        
    if ( g_Restrictions[id] )
    {
        format( szHUD , 255 , "[Weapon Restrictions]^n" );

        for ( new i = 1; i <= 30 ; i++ )
            if( 1 & (g_Restrictions[id] >> i) )
                format( szHUD , 255 , "%s^n%s" , szHUD , g_WeaponNames );
    }
    else
    {
        format( szHUD , 255 , "[Weapon Restrictions]^n^nYou have no weapon restrictions." );
    }

    format( szHUD , 255 , "%s^n^nSay /restrict to see restrictions." , szHUD );

    set_hudmessage( 255 , 255 , 255 , 0.10 , 0.55 , 0 , 6.0 , 6.0 , 0.5 , 0.15 , 3 );    
    show_hudmessage( id , szHUD );
    
    return PLUGIN_HANDLED;
}

public AddRestrict(id, level, cid)
{
    if ( !cmd_access(id,level,cid,1) )
        return PLUGIN_HANDLED; 
    
    if ( read_argc() != 3 )
    {
        console_print( id , "* Insufficient parameters. Proper usage: amx_restrictadd <player> <weapon>" );
        return PLUGIN_HANDLED;
    }
    
    new argName[33];
    new argWeap[20];
        
    read_argv( 1, argName, 32 );
    read_argv( 2, argWeap, 19 );
    
    new iPlayer = cmd_target( id , argName , 8 );
    if ( !iPlayer )
        return PLUGIN_HANDLED;
        
    get_user_name( iPlayer , argName, 32 );
    
    new iWeapon = GetWeaponIndex( argWeap , 2 );
    
    if ( !iWeapon )
    {
        console_print( id , "* Invalid weapon, please try again using part or all of the weapons name." );
        return PLUGIN_HANDLED;
    }

    if ( 1 & (g_Restrictions[iPlayer] >> iWeapon) )
    {
        console_print( id , "* %s already has %s as a weapon restriction." , argName , g_WeaponNames[iWeapon ] );
        return PLUGIN_HANDLED;
    }
        
    //Add restriction flag bit to bit field
    g_Restrictions[iPlayer] |= (1 << iWeapon);

    //Display new restriction to player
    static szHUD[256];
    format( szHUD , 255 , "[Weapon Restrictions]^n^nRestriction Added: %s^n^nSay /restrict to view restrictions." , g_WeaponNames[iWeapon] );
    set_hudmessage( 255 , 255 , 255 , 0.10 , 0.55 , 0 , 6.0 , 6.0 , 0.5 , 0.15 , 3 );    
    show_hudmessage( iPlayer , szHUD );

    console_print( id , "* Weapon restriction for %s has been added on player %s." , g_WeaponNames[iWeapon] , argName );
    
    //If the user has the weapon we just added a restriction for, make player drop weapon.
    if ( user_has_weapon( iPlayer , iWeapon ) )    
    {
        new iCurrent = get_user_weapon(id);
    
        switch ( iWeapon )
        {
            case CSW_HEGRENADE , CSW_FLASHBANG , CSW_SMOKEGRENADE: DropWeapon( iPlayer , iWeapon );
            default: 
            {
                format( argWeap , 19 , "weapon_%s" , g_WeaponNames[iWeapon] );
                engclient_cmd( iPlayer, "drop", argWeap );
            }
        }

        //If player was holding weapon we just restricted, set weapon according to priority
        if ( iCurrent == iWeapon )
            SetWeaponPriority( id );
    }

    SaveRestrict( id );

    CheckForwards();

    return PLUGIN_HANDLED;
}

public RemoveRestrict(id, level, cid)
{
    if ( !cmd_access(id,level,cid,1) )
        return PLUGIN_HANDLED; 

    if ( read_argc() != 3 )
    {
        console_print( id , "* Insufficient parameters. Proper usage: amx_restrictremove <player> <weapon>" );
        return PLUGIN_HANDLED;
    }
    
    new argName[33];
    new argWeap[20];
    static szAuthID[35];
    static szHUD[256];
    
    read_argv( 1 , argName , 32 );
    read_argv( 2 , argWeap , 19 );

    new iPlayer = cmd_target( id , argName , 8 );
    if ( !iPlayer )
        return PLUGIN_HANDLED;

    get_user_name( iPlayer , argName , 32 );
    
    if ( !g_Restrictions[id] )
    {
        console_print( id , "* %s currently has no weapon restrictions." , argName );
        return PLUGIN_HANDLED;
    }
    
    new iWeapon = GetWeaponIndex( argWeap , 2 );
    
    if ( !iWeapon )
    {
        console_print( id , "* Invalid weapon, please try again using part or all of the weapons name." );
        return PLUGIN_HANDLED;
    }

    if ( 1 & (g_Restrictions[iPlayer] >> iWeapon) )
    {
        //Remove restriction bit from bit field
        g_Restrictions[iPlayer] &= ~(1 << iWeapon);
    }
    else
    {
        console_print( id , "* %s does not have the %s as a weapon restriction." , argName , g_WeaponNames[GetWeaponIndex(argWeap,2)]);
        return PLUGIN_HANDLED;    
    }

    set_hudmessage( 255 , 255 , 255 , 0.10 , 0.55 , 0 , 6.0 , 6.0 , 0.5 , 0.15 , 3 );    

    if ( !g_Restrictions[iPlayer] )
    {
        format( szHUD , 255 , "[Weapon Restrictions]^n^nAll of your weapon restrictions have been removed.^n^nSay /restrict to view restrictions." );
        show_hudmessage( iPlayer , szHUD );
        get_user_authid( iPlayer , szAuthID , 34 );
        nvault_remove( g_NvID , szAuthID );

        CheckForwards();
    }
    else
    {
        format( szHUD , 255 , "[Weapon Restrictions]^n^nThe following restriction has been removed:^n^n%s^n^nSay /restrict to view restrictions" , g_WeaponNames[GetWeaponIndex(argWeap,2)] );
        show_hudmessage( iPlayer , szHUD );
        SaveRestrict( iPlayer );
    }

    return PLUGIN_HANDLED;
}

public ClearRestrict(id, level, cid)
{
    if ( !cmd_access(id,level,cid,1) )
        return PLUGIN_HANDLED; 
    
    if ( read_argc() != 2 )
    {
        console_print( id , "* Insufficient parameters. Proper usage: amx_restrictclear <player>" );
        return PLUGIN_HANDLED;
    }
        
    new argName[33];
    new szAuthID[35];
    
    read_argv( 1 , argName , 32 );

    new iPlayer = cmd_target( id , argName , 8 );
    if ( !iPlayer )
        return PLUGIN_HANDLED;
        
    get_user_name( iPlayer , argName , 32 );
    
    if ( g_Restrictions[iPlayer] )
    {
        get_user_authid( iPlayer, szAuthID, 34);
        nvault_remove( g_NvID , szAuthID);
        
        g_Restrictions[iPlayer] = 0;

        static szHUD[256];
        format( szHUD , 255 , "[Weapon Restrictions]^n^nAll of your weapon restrictions have been removed.^n^nSay /restrict to view restrictions." );
        set_hudmessage( 255, 255, 255, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3 );    
        show_hudmessage( iPlayer , szHUD );

        console_print( id , "* Weapon restrictions for %s have been cleared." , argName );

        CheckForwards();
    }
    else
    {
        console_print( id , "* %s currently has no weapon restrictions." , argName );
    }

    return PLUGIN_HANDLED;
}

public SaveRestrict(id)
{
    new szAuthID[35];
    new szSaveString[12];
    
    get_user_authid( id , szAuthID , 34 );
    format( szSaveString , 11 , "%d", g_Restrictions[id] );
    nvault_set( g_NvID , szAuthID , szSaveString );
}


public ShowRestrict(id , level, cid)
{
    if ( !cmd_access(id,level,cid,1) )
        return PLUGIN_HANDLED; 
    
    if ( read_argc() != 2 )
    {
        console_print( id , "* Insufficient parameters. Proper usage: amx_restrictshow <player>" );
        return PLUGIN_HANDLED;
    }
        
    new argName[33];
    new szWeapons[162];    

    read_argv( 1 , argName , 32 );

    new iPlayer = cmd_target( id , argName , 8 );
    if ( !iPlayer )
        return PLUGIN_HANDLED;
        
    get_user_name( iPlayer , argName , 32 );

    if ( g_Restrictions[iPlayer] )
    {
        for( new i = 1 ; i <= 30 ; i++ )
            if( 1 & (g_Restrictions[iPlayer] >> i) )
                format( szWeapons , 161 , "%s %s" , szWeapons , g_WeaponNames );
        
        console_print( id , "* %s currently has the following weapon restrictions: %s" , argName , szWeapons );
    }
    else
    {
        console_print( id , "* %s currently has no weapon restrictions." , argName );
    }
    
    return PLUGIN_HANDLED;
}

public GetWeaponIndex(szPartial[], iType)
{
    //Type1: Entire weapon name entered as param, check if g_WeaponNames is within
    //Type2: Partial weapon entered as param, check if found within g_WeaponNames
    if ( iType == 1 )
    {
        for( new i = 0; i < 33; i++ )
            if ( containi( szPartial , g_WeaponNames ) != -1 )
                return i;
    }
    else
    {
        for( new i = 0; i < 33; i++ )
            if ( containi( g_WeaponNames , szPartial ) != -1 )
                return i;    
    }
    
    return 0;
}

public DropWeapon(id, iWeapon)
{
    if ( !user_has_weapon(id,iWeapon) )
        return PLUGIN_HANDLED;
        
    new iOldWeapon = get_user_weapon(id);
    
    new iWeaponEnt = fm_get_user_weapon_entity(id, iWeapon);
    if ( !iWeaponEnt )
        return PLUGIN_HANDLED;
    
    ExecuteHam(Ham_RemovePlayerItem, id, iWeaponEnt);
    ExecuteHam(Ham_Item_Kill, iWeaponEnt);
    set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<iWeapon));
    
    if( (iWeapon == CSW_HEGRENADE) || (iWeapon == CSW_FLASHBANG) || (iWeapon == CSW_SMOKEGRENADE) )
        fm_set_user_bpammo(id, iWeapon , 0 );
    
    if ( iOldWeapon == iWeapon )
        SetPriority(id, iOldWeapon);
    
    return PLUGIN_HANDLED;
}

public SetPriority(id, iOldWeapon)
{
    for (new j = 0; j < WEAPONS; ++j) {
        if (user_has_weapon(id, WEAPON_PRIORITY[j]) && iOldWeapon != WEAPON_PRIORITY[j]) 
        { 
            new wname[20]; 
            get_weaponname(WEAPON_PRIORITY[j], wname, 19) ;
            engclient_cmd(id, wname);
            break;
        }
    }
}

public PrintMsg( id , szMessage[] ) 
{
    new Float:fGameTime = get_gametime();
    
    if ( (fGameTime >= g_fMsgDelay[id]) || (iSaid[id] <= 3) )
    {
        if ( fGameTime >= g_fMsgDelay[id] )
            iSaid[id] = 0;
            
        client_print( id , print_chat , "%s" , szMessage );
        iSaid[id]++;
        
        g_fMsgDelay[id] = fGameTime + 0.5;
    }
}

public SetWeaponPriority(id)
{
    for ( new j = 0 ; j < WEAPONS ; ++j ) 
    {
        if ( user_has_weapon( id , WEAPON_PRIORITY[j] ) ) 
        { 
            new wname[20] ;
            get_weaponname( WEAPON_PRIORITY[j] , wname , 19 ) ;
            engclient_cmd( id , wname );
            break;
        }
    }
}

public ReimburseMoney(param[2])
{
    new id = param[0];
    new iMoney = param[1];
    fm_set_user_money( id , clamp( (get_pdata_int(id, OFFSET_CSMONEY) + iMoney ) , 0 , 16000 ) , 1 );
}

public fm_set_user_bpammo(id, iType, iAmt)
{
    new iOffset;

    switch ( iType )
    {
        case CSW_HEGRENADE: iOffset = OFFSET_HE_AMMO;
        case CSW_SMOKEGRENADE: iOffset = OFFSET_SMOKE_AMMO;
        case CSW_FLASHBANG: iOffset = OFFSET_FLASH_AMMO;
    }
    
    if( iOffset )
        set_pdata_int( id, iOffset , iAmt );
} 

public fm_get_user_bpammo(id, iType)
{
    new iOffset;

    switch ( iType )
    {
        case CSW_HEGRENADE: iOffset = OFFSET_HE_AMMO;
        case CSW_SMOKEGRENADE: iOffset = OFFSET_SMOKE_AMMO;
        case CSW_FLASHBANG: iOffset = OFFSET_FLASH_AMMO;
    }
    
    if( iOffset )
        return get_pdata_int( id , iOffset );

    return 0;
}  

public fm_set_user_money(index, money, flash) 
{
    set_pdata_int( index , OFFSET_CSMONEY , money );
    
    message_begin( MSG_ONE_UNRELIABLE , g_MsgMoney , _ , index );
    write_long( money );
    write_byte( flash ? 1 : 0 );
    message_end();
}

//Block weapon from being purchased and reimburse players money.
public fw_AddPlayerItem( iPlayer ,iItem )
{
    static szClassname[32];
    pev( iItem , pev_classname , szClassname , 31 );
    
    new iWeaponIndex = GetWeaponIndex( szClassname , 1 );

    if( !iWeaponIndex )
        return HAM_IGNORED;
    
    if ( 1 & (g_Restrictions[iPlayer] >> iWeaponIndex) )
    {    
        static szMsg[99];
        new iParam[2];
        
        iParam[0] = iPlayer;
        iParam[1] = g_WeaponPrice[iWeaponIndex];
        set_task( 0.15 , "ReimburseMoney" ,_, iParam , 2 );
        
        format( szMsg , 98 , "* You are restricted from using %s. Your money has been reimbursed. [$%d]" , szClassname[7] , g_WeaponPrice[iWeaponIndex] );
        PrintMsg( iPlayer , szMsg );
        
        SetHamReturnInteger( 1 );
        return HAM_SUPERCEDE;
    }
    
    return HAM_IGNORED;
}

//Block weapon pickup when walked over. (When weapon has been dropped by a player)
public fw_Touch( iEnt , iPlayer ) 
{ 
    if ( !( 1 <= iPlayer <= g_MaxClients ) || !g_Restrictions[iPlayer] || !pev_valid(iEnt ) || !( pev( iEnt , pev_flags ) & FL_ONGROUND ) )
        return FMRES_IGNORED;
        
    static szEntModel[32];
    pev( iEnt  , pev_model , szEntModel , 31 );
    
    return ( 1 & ( g_Restrictions[iPlayer] >> GetWeaponIndex( szEntModel , 1 ) ) ) ? FMRES_SUPERCEDE : FMRES_IGNORED;
}
В плагине для запрета оружие определенному игроку, запрет скидывается после смены карты.
 

Vaqtincha

aggressive
Разработчик
Скриптер
Регистрация
28 Янв 2018
Сообщения
962
Симпатии
684
Пол
Мужской
А проверяли файл iwr_data ? Сколько он весит ?
Плагин устарел. Для регейма можно написать более простой код используя его апи.
 

bake2

Пользователь
Регистрация
3 Окт 2019
Сообщения
169
Симпатии
4

Вложения

Vaqtincha

aggressive
Разработчик
Скриптер
Регистрация
28 Янв 2018
Сообщения
962
Симпатии
684
Пол
Мужской
bake2,
Наверное биты запрещённых оружий.
Строку (155)
get_user_authid( id , steamid , 34 );
пробуйте заменить на
get_user_authid( id , szAuthID , 34 );



Мне непонятно кто его туда добавил и как он компилился с такой ошибкой.
 

bake2

Пользователь
Регистрация
3 Окт 2019
Сообщения
169
Симпатии
4
bake2,
Наверное биты запрещённых оружий.
Строку (155)
get_user_authid( id , steamid , 34 );
пробуйте заменить на
get_user_authid( id , szAuthID , 34 );



Мне непонятно кто его туда добавил и как он компилился с такой ошибкой.
это я написал и забыл, он и не компилировался с такой ошибкой. Не сохранялся еще до того как я трогал код. Сейчас я просто поставил лимит авп на 1, чем каждому лично запрещать.
 
Сверху Снизу