Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

помогите исправить плагины

, Ошибка в в плагимнах
Статус пользователя kavkaz
сообщение 1.5.2011, 14:02
Сообщение #1
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

народ помогите исправить 2 плагина ошибки вот какие:
Код
[FUN] Item "ammo_308" failed to create
Displaying debug trace (plugin "weaponmenu.amxx")
Run time error 10: native error (native "give_item")
[0] textZOcbsd.sma::GivePlayerExtra (line 725)
[1] textZOcbsd.sma::GiveMenuItem (line 693)
[2] textZOcbsd.sma::PlayerMenuCmd (line 351)
и
AMXX] Run time error 4: index out of bounds
[0] colorchat.inc::ColorChat (line 74)
[1] info_rank.sma::event_player_spawn (line 102)
[2] info_rank.sma::eResetHUD (line 71)


*inforank
Код
#include <amxmodx>
#include <csx>
#include <colorchat>

// Uncomment line below if you want messages to be disabled by default
// (aka players have to type /inrorank to enable them).
// #define DISABLED_BY_DEFAULT

#if defined DISABLED_BY_DEFAULT
    new bool:disabled[33] = {true, ...}
#else
    new bool:disabled[33]
#endif

new bool:g_RestartAttempt[33], g_oldrank[33], inforank

public plugin_init()
{
    register_plugin("Info Rank", "1.0", "connor")
    register_dictionary("inforank.txt")
    
    inforank = register_cvar("amx_inforank", "1")
    
    register_event("TextMsg", "eRestartAttempt", "a", "2=#Game_will_restart_in")
    register_event("ResetHUD", "eResetHUD", "be")
    
    register_clcmd("say /inforank", "switchCmd", 0, "- enable/disable info rank messages")
    register_clcmd("say_team /inforank", "switchCmd", 0, "- enable/disable info rank messages")
    register_clcmd("fullupdate", "fullupdateCmd")
}

public fullupdateCmd()
{
    return PLUGIN_HANDLED_MAIN
}

public eRestartAttempt()
{
    if (!get_pcvar_num(inforank))
    {
        return
    }
    
    new players[32], num
    get_players(players, num, "a")
    
    for (new i; i < num; ++i)
    {
        g_RestartAttempt[players[i]] = true
    }
}

public eResetHUD(id)
{
    if (g_RestartAttempt[id])
    {
        g_RestartAttempt[id] = false
        return
    }
    
    if (!get_pcvar_num(inforank))
    {
        return
    }
    
    if (disabled[id])
    {
        return
    }
    
    event_player_spawn(id)
}

public event_player_spawn(id)
{
    new osef[8]
    new rank = get_user_stats(id, osef, osef)
    new maxrank = get_statsnum()
    
    if(g_oldrank[id] == 0)
    {
        g_oldrank[id] = rank
    }
    
    new diff = g_oldrank[id] - rank
    g_oldrank[id] = rank
    
    new mess[192]
    
    if (diff > 0)
    {
        formatex(mess, 191, "%L", id, "IR_GOOD", diff)
        ColorChat(id, GREEN, mess)
    }
    else if (diff < 0)
    {
        formatex(mess, 191, "%L", id, "IR_BAD", abs(diff))
        ColorChat(id, RED, mess)
    }
    
    formatex(mess, 191, "%L", id, "IR_RANK", rank, maxrank)
    ColorChat(id, GREY, mess)
}

public switchCmd(id)
{
    if (!get_pcvar_num(inforank))
    {
        return PLUGIN_CONTINUE
    }
    
    if (disabled[id])
    {
        disabled[id] = false
        client_cmd(id, "setinfo _ir 1")
        client_print(id, print_chat, "%L", id, "IR_ENABLE")
    }
    else
    {
        disabled[id] = true
        client_cmd(id, "setinfo _ir 0")
        client_print(id, print_chat, "%L", id, "IR_DISABLE")
    }
    return PLUGIN_CONTINUE
}

public client_authorized(id)
{
    new osef[8]
    g_oldrank[id] = get_user_stats(id, osef, osef)
    
    new enable[2]
    get_user_info(id, "_ir", enable, 1)
    
    if (!enable[0])
    {
        return
    }
    
    if (enable[0]=='1')
    {
        disabled[id] = false
    }
    else
    {
        disabled[id] = true
    }
}

public client_disconnect(id)
{
    g_oldrank[id] = 0
    
    #if defined DISABLED_BY_DEFAULT
        disabled[id] = true
    #else
        disabled[id] = false
    #endif
}

и
*weaponmenu
Код
/* AMX Mod script.
#include <amxmodx>
#include <amxmisc>

// This is ONLY Required to Compile for AMX Mod X v1.0
// Comment or Remove to compile for AMX 0.9.9
#include <fun>


// Max Values for Building Menus
#define MAX_PLAYERS     32
#define MAX_WEAPONS     24
#define MAX_AMMO        11
#define MAX_ITEMS        8
#define MAX_DISPLAY      8

// Menu Type Indexes
#define MT_PISTOL        0
#define MT_SHOTGUN       1
#define MT_SMG           2
#define MT_RIFLE         3
#define MT_MACHINE       4
#define MT_PAMMO         5
#define MT_SAMMO         6
#define MT_EQUIP         7
#define MT_EXTRA         8

// Array Index Offsets for Pin-pointing correct weapon
#define OFFSET_SHOTGUN   6
#define OFFSET_SMG       8
#define OFFSET_RIFLE    13
#define OFFSET_MACHINE  23

// Max Menu Options for Each Menu
// (Machine Gun Menu is Only 1 Option, so no array needed for it)
#define MO_MAX_MAIN      9
#define MO_MAX_PISTOL    6
#define MO_MAX_SHOTGUN   2
#define MO_MAX_SMG       5
#define MO_MAX_RIFLE    10
#define MO_MAX_EQUIP     8
#define MO_MAX_EXTRA    14


// Main Menu Text
new g_szMainMenuTxt[MO_MAX_MAIN][] = {
"Pistols",
"Shotguns",
"SMGs",
"Rifles",
"Machine Guns",
"Primary Ammo",
"Secondary Ammo",
"Equipment",
"Extras Menu"
}

// Pistols Menu Text
new g_szPistolMenuTxt[MO_MAX_PISTOL][] = {
"USP",
"Glock",
"Deagle",
"228 Compact",
"Dual Elites",
"Five-Seven"
}

//Shotguns Section
new g_szShotgunMenuTxt[MO_MAX_SHOTGUN][] = {
"Pump Shotgun",
"Auto Shotgun"
}

//SMG Section
new g_szSmgMenuTxt[MO_MAX_SMG][] = {
"MP5",
"TMP",
"C90",
"Mac10",
"UMP"
}

//Rifles Section
new g_szRifleMenuTxt[MO_MAX_RIFLE][] = {
"Clarion",
"Krieg SG552",
"AK47",
"M4A1",
"Bullpup",
"Scout",
"AWP",
"CT AutoSniper",
"T AutoSniper",
"Galil"
}

//Machine Guns Section
new g_szMachineMenuTxt[] = "M249 (Para)"

//Equipment Section
new g_szEquipMenuTxt[MO_MAX_EQUIP][] = {
"Kevlar",
"Kevlar + Helmet",
"Flashbang Grenade",
"HE Grenade",
"Smoke Grenade",
"Defusal Kit",
"Nighvision Goggles",
"Shield"
}

//Extras Section
new g_szExtraMenuTxt[MO_MAX_EXTRA][] = {
"All Weapons",
"M3 Set",
"MP5 Navy Set",
"Clarion Set",
"Galil Set",
"M4A1 Set",
"AK47 Set",
"Krieg SG552 Set",
"Bullpup Set",
"M249 Set",
"Scout Set",
"AutoSniper Set",
"AWP Set",
"Nades Set"
}

// Names of Weapons for give_item() native
new g_szWeaponList[MAX_WEAPONS][] = {
  "weapon_usp", "weapon_glock18", "weapon_deagle", "weapon_p228", "weapon_elite",
  "weapon_fiveseven", "weapon_m3", "weapon_xm1014", "weapon_mp5navy", "weapon_tmp",
  "weapon_p90", "weapon_mac10", "weapon_ump45", "weapon_famas", "weapon_sg552",
  "weapon_ak47", "weapon_m4a1", "weapon_aug", "weapon_scout", "weapon_awp",
  "weapon_g3sg1", "weapon_sg550", "weapon_galil", "weapon_m249"
}

// Names of Equipment Items for give_item() native
new g_szItemsList[MAX_ITEMS][] = {
  "item_kevlar", "item_assaultsuit", "weapon_flashbang", "weapon_hegrenade",
  "weapon_smokegrenade", "item_thighpack", "item_nvgs", "weapon_shield"
}

// Names of Ammo Packs for give_item() native
new g_szAmmoList[MAX_AMMO][] = {
  "ammo_45acp", "ammo_9mm", "ammo_50ae", "ammo_357sig",
  "ammo_57mm", "ammo_buckshot", "ammo_556nato", "ammo_762nato",
  "ammo_338magnum", "ammo_308", "ammo_556natobox"
}

new g_nWeaponData[MAX_WEAPONS][2] = {
  { 0, 8 }, { 1, 8 }, { 2, 5 }, { 3, 6 }, { 1, 4 },
  { 4, 4 }, { 5, 4 }, { 5, 4 }, { 1, 4 }, { 1, 4 },
  { 4, 4 }, { 0, 6 }, { 0, 6 }, { 6, 3 }, { 6, 3 },
  { 7, 3 }, { 6, 3 }, { 6, 3 }, { 7, 3 }, { 8, 3 },
  { 7, 3 }, { 6, 3 }, { 9, 3 }, { 10, 7 }
}

// Tracks what page in menu you're on in Multi-Page Menus (Like Rifles and Players Menu)
// Multiple players may open menu at same time, so we keep an array of MAX_PLAYERS (32)
// to track each individual's menu page.
// Player IDs range from 1-32 but our Array ranges from 0-31 so we minus 1 from PlayerID
// when we use this array.  Example: g_nMenuPosition[ id - 1 ]
new g_nMenuPosition[MAX_PLAYERS]

// We use this to track what menu the user is actually in so we can determine which menu
// to display next.  Different Menu types are: Main, Pistols, Shotguns, SMGs, Rifles, etc..
new g_nMenuType[MAX_PLAYERS]

// Tracks which option in the menu was chosen
new g_nMenuOption[MAX_PLAYERS]


// The following are used for the Players Menu to Track Player Chosen
new g_nMenuPlayers[MAX_PLAYERS][MAX_PLAYERS]
new g_nMenuPlayersNum[MAX_PLAYERS]


public plugin_init()
{
    register_plugin( "Weapon Menu", "1.0", "Mattcook & xeroblood" )

    register_clcmd( "amx_weaponmenu", "ShowWeaponMenu", ADMIN_MENU, "Shows The Weapon Menu" )
    register_clcmd( "weaponmenu", "ShowWeaponMenu", ADMIN_MENU, "Shows The Weapon Menu" )

    register_cvar( "sv_weaponmenu_smoke", "1" ) // Give Smoke Nades?  (1 = Yes, 0 = No)
    register_cvar( "sv_weaponmenu_state", "1" ) // Weapon Menu Return State
                                                // 0 = Exit Menu After Give-Item
                                                // 1 = Return to Players Menu
                                                // 2 = Return to Weapons Menu

    register_menucmd( register_menuid("Weapons Menu:"),      1023, "MainMenuCmd" )
    register_menucmd( register_menuid("Pistols Menu:"),      1023, "RegularMenuCmd" )
    register_menucmd( register_menuid("Shotguns Menu:"),     1023, "RegularMenuCmd" )
    register_menucmd( register_menuid("SMGs Menu:"),         1023, "RegularMenuCmd" )
    register_menucmd( register_menuid("Rifles Menu:"),       1023, "RifleMenuCmd" )
    register_menucmd( register_menuid("Machine Guns Menu:"), 1023, "RegularMenuCmd" )
    register_menucmd( register_menuid("Equipment Menu:"),    1023, "RegularMenuCmd" )
    register_menucmd( register_menuid("Extras Menu:"),       1023, "ExtraMenuCmd" )
    register_menucmd( register_menuid("Players Menu:"),      1023, "PlayerMenuCmd" )

    return PLUGIN_CONTINUE
}

public ShowWeaponMenu( id, lvl, cid )
{
    if( cmd_access( id, lvl, cid, 0 ) )
    {
        g_nMenuPosition[id-1] = 0
        ShowMainMenu( id )
    }
    return PLUGIN_HANDLED
}

///////////////////////////////////////////////////////////////////////////////////////////
//
//      Menu Handling Code Below
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Handles Menu Menu
public MainMenuCmd( id, key )
{
    // Track which Menu Type was chosen
    g_nMenuType[id-1] = key

    switch( key )
    {
        case 0: ShowPistolMenu( id )
        case 1: ShowShotgunMenu( id )
        case 2: ShowSmgMenu( id )
        case 3: ShowRifleMenu( id, g_nMenuPosition[id-1] = 0 )
        case 4: ShowMachineMenu( id )
        case 5: ShowPlayerMenu( id, g_nMenuPosition[id-1] = 0 )
        case 6: ShowPlayerMenu( id, g_nMenuPosition[id-1] = 0 )
        case 7: ShowEquipMenu( id )
        case 8: ShowExtraMenu( id, g_nMenuPosition[id-1] = 0 )
        default: { /* Do Nothing Here (Exit Option) */ }
    }
    return PLUGIN_HANDLED
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Handles all Weapon Menus Except Multi-Page ones like Rifles Menu
public RegularMenuCmd( id, key )
{
    // Track which Option was chosen
    g_nMenuOption[id-1] = key

    switch( key )
    {
        case 9:
        {
            // User Chose to go Back to Previous Menu
            ShowMainMenu( id )
        }
        default: ShowPlayerMenu( id, g_nMenuPosition[id-1] = 0 )
    }
    return PLUGIN_HANDLED
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Handles Multi-Page Rifles Menu
public RifleMenuCmd( id, key )
{
    // Track which Option was chosen
    g_nMenuOption[id-1] = g_nMenuPosition[id-1] * MAX_DISPLAY + key

    switch( key )
    {
        case 8:
        {
            // User Selected "More..." Option
            ShowRifleMenu( id, ++g_nMenuPosition[id-1] )
        }
        case 9:
        {
            // User Chose to go Back to Previous Menu
            if( g_nMenuPosition[id-1] )
            {
                ShowRifleMenu( id, --g_nMenuPosition[id-1] )
            }else
            {
                ShowMainMenu( id )
            }
        }
        default: ShowPlayerMenu( id, g_nMenuPosition[id-1] = 0 )
    }
    return PLUGIN_HANDLED
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Handles Multi-Page Players Menu
public PlayerMenuCmd( id, key )
{
    switch( key )
    {
        case 8:
        {
            // User Selected "More..." Option
            ShowPlayerMenu( id, ++g_nMenuPosition[id-1] )
        }
        case 9:
        {
            // User Chose to go Back to Previous Menu
            if( g_nMenuPosition[id-1] )
            {
                ShowPlayerMenu( id, --g_nMenuPosition[id-1] )
            }else
            {
                ShowMainMenu( id )
            }
        }
        default:
        {
            // Find which Player was chosen
            new nPlayerID = g_nMenuPlayers[id-1][g_nMenuPosition[id-1] * MAX_DISPLAY + key]

            // Give Player Selected Item
            GiveMenuItem( id, nPlayerID )

            // Check which Menu to Re-Open (if any)
            switch( clamp(get_cvar_num("sv_weaponmenu_state"), 0, 2) )
            {
                case 1: ShowPlayerMenu( id, g_nMenuPosition[id-1] ) // Players Menu (At Last Position)
                case 2: ShowMainMenu( id ) // Weapons Menu
            }
        }
    }
    return PLUGIN_HANDLED
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Handles Multi-Page Extras Menu
public ExtraMenuCmd( id, key )
{
    // Track which Option was chosen
    g_nMenuOption[id-1] = g_nMenuPosition[id-1] * MAX_DISPLAY + key

    switch( key )
    {
        case 8:
        {
            // User Selected "More..." Option
            ShowExtraMenu( id, ++g_nMenuPosition[id-1] )
        }
        case 9:
        {
            // User Chose to go Back to Previous Menu
            if( g_nMenuPosition[id-1] )
            {
                ShowExtraMenu( id, --g_nMenuPosition[id-1] )
            }else
            {
                ShowMainMenu( id )
            }
        }
        default: ShowPlayerMenu( id, g_nMenuPosition[id-1] = 0 )
    }
    return PLUGIN_HANDLED
}
//
///////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////
//
//      Menu Building Code Below
//
///////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////
// Build Main Menu Section
public ShowMainMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yWeapons Menu:\w^n" )
    for( i = 0; i < MO_MAX_MAIN; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szMainMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Exit" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Pistol Menu Section
public ShowPistolMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yPistols Menu:\w^n" )
    for( i = 0; i < MO_MAX_PISTOL; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szPistolMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Shotgun Menu Section
public ShowShotgunMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yShotguns Menu:\w^n" )
    for( i = 0; i < MO_MAX_SHOTGUN; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szShotgunMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build SMG Menu Section
public ShowSmgMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[2256]

    nLen = format( szMenuBody, 255, "\ySMGs Menu:\w^n" )
    for( i = 0; i < MO_MAX_SMG; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szSmgMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Rifle Menu Section
public ShowRifleMenu( id, pos )
{
    if( pos < 0 ) return

    new i, j = 0, nStart, nEnd, nLen, nKeys = (1<<9)
    new szMenuBody[512]

    nStart = pos * MAX_DISPLAY

    if( nStart >= MO_MAX_RIFLE )
        nStart = pos = g_nMenuPosition[id-1] = 0

    nLen = format( szMenuBody, 511, "\yRifles Menu:\R%d/2^n\w^n", pos + 1 )

    nEnd = nStart + MAX_DISPLAY
    if( nEnd > MO_MAX_RIFLE ) nEnd = MO_MAX_RIFLE

    for( i = nStart; i < nEnd; i++ )
    {
        nKeys |= (1<<j++)
        nLen += format( szMenuBody[nLen], (511-nLen), "%d. %s^n", j, g_szRifleMenuTxt[i] )
    }

    if( nEnd != MO_MAX_RIFLE )
    {
        format( szMenuBody[nLen], (511-nLen), "^n9. More...^n0. Back" )
        nKeys |= (1<<8)
    }
    else format( szMenuBody[nLen], (511-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Machine Gun Menu Section
public ShowMachineMenu( id )
{
    new nLen, nKeys = (1<<0|1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yMachine Guns Menu:\w^n" )
    nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", 1, g_szMachineMenuTxt )
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Equipment Menu Section
public ShowEquipMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yEquipment Menu:\w^n" )
    for( i = 0; i < MO_MAX_EQUIP; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szEquipMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Extras Menu Section
/*
public ShowExtraMenu( id )
{
    new i, nLen, nKeys = (1<<9)
    new szMenuBody[256]

    nLen = format( szMenuBody, 255, "\yExtras Menu:\w^n" )
    for( i = 0; i < MO_MAX_EXTRA; i++ )
    {
        nKeys |= (1<<i)
        nLen += format( szMenuBody[nLen], (255-nLen), "%d. %s^n", (i+1), g_szExtraMenuTxt[i] )
    }
    format( szMenuBody[nLen], (255-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}*/

public ShowExtraMenu( id, pos )
{
    if( pos < 0 ) return

    new i, j = 0, nStart, nEnd, nLen, nKeys = (1<<9)
    new szMenuBody[512]

    nStart = pos * MAX_DISPLAY

    if( nStart >= MO_MAX_EXTRA )
        nStart = pos = g_nMenuPosition[id-1] = 0

    nLen = format( szMenuBody, 511, "\yExtras Menu:\R%d/2^n\w^n", pos + 1 )

    nEnd = nStart + MAX_DISPLAY
    if( nEnd > MO_MAX_EXTRA ) nEnd = MO_MAX_EXTRA

    for( i = nStart; i < nEnd; i++ )
    {
        nKeys |= (1<<j++)
        nLen += format( szMenuBody[nLen], (511-nLen), "%d. %s^n", j, g_szExtraMenuTxt[i] )
    }

    if( nEnd != MO_MAX_EXTRA )
    {
        format( szMenuBody[nLen], (511-nLen), "^n9. More...^n0. Back" )
        nKeys |= (1<<8)
    }
    else format( szMenuBody[nLen], (511-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody, -1 )
    return
}

//
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Build Player Menu Section
public ShowPlayerMenu( id, pos )
{
    if( pos < 0 ) return

    get_players( g_nMenuPlayers[id-1], g_nMenuPlayersNum[id-1] )

    new i, j = 0, idx
    new szUserName[32], szMenuBody[512]
    new nStart = pos * MAX_DISPLAY

    if( nStart >= g_nMenuPlayersNum[id-1] )
        nStart = pos = g_nMenuPosition[id-1] = 0

    new nLen = format( szMenuBody, 511, "\yPlayers Menu:\R%d/%d^n\w^n", (pos+1), (g_nMenuPlayersNum[id-1] / MAX_DISPLAY + ((g_nMenuPlayersNum[id-1] % MAX_DISPLAY) ? 1 : 0 )) )
    new nEnd = nStart + MAX_DISPLAY
    new nKeys = (1<<9)

    if( nEnd > g_nMenuPlayersNum[id-1] )
        nEnd = g_nMenuPlayersNum[id-1]

    for( i = nStart; i < nEnd; i++ )
    {
        idx = g_nMenuPlayers[id-1][i]
        get_user_name( idx, szUserName, 31 )

        nKeys |= (1<<j++)
        nLen += format( szMenuBody[nLen], (511-nLen), "%d. %s^n", j, szUserName )
    }

    if( nEnd != g_nMenuPlayersNum[id-1] )
    {
        nKeys |= (1<<8)
        format( szMenuBody[nLen], (511-nLen), "^n9. More...^n0. Back" )
    }
    else format( szMenuBody[nLen], (511-nLen), "^n0. Back" )

    show_menu( id, nKeys, szMenuBody )
    return
}
//
///////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////
//
//      Weapon Giving Code Below
//
///////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////
//  Following Functions Actually Give The Items
//
stock GiveMenuItem( id, p_nPlayerID )
{
    new szUserName[32]
    get_user_name( p_nPlayerID, szUserName, 31 )

    switch( g_nMenuType[id-1] )
    {
        case MT_PISTOL:  GivePlayerWeapon( p_nPlayerID, g_nMenuOption[id-1] )
        case MT_SHOTGUN: GivePlayerWeapon( p_nPlayerID, (OFFSET_SHOTGUN + g_nMenuOption[id-1]) )
        case MT_SMG:     GivePlayerWeapon( p_nPlayerID, (OFFSET_SMG + g_nMenuOption[id-1]) )
        case MT_RIFLE:   GivePlayerWeapon( p_nPlayerID, (OFFSET_RIFLE + g_nMenuOption[id-1]) )
        case MT_MACHINE: GivePlayerWeapon( p_nPlayerID, (OFFSET_MACHINE + g_nMenuOption[id-1]) )
        case MT_PAMMO:   GivePrimaryAmmo( p_nPlayerID )
        case MT_SAMMO:   GiveSecondaryAmmo( p_nPlayerID )
        case MT_EQUIP:   GivePlayerItem( p_nPlayerID, g_nMenuOption[id-1] )
        case MT_EXTRA:   GivePlayerExtra( p_nPlayerID, g_nMenuOption[id-1] )
    }
    return
}


stock GivePlayerWeapon( id, nWeaponIdx )
{
    if( !is_user_alive(id) || (nWeaponIdx < 0) || (nWeaponIdx >= MAX_WEAPONS) )
        return // Invalid User or Weapon

    give_item( id, g_szWeaponList[nWeaponIdx] )
    for( new i = 0; i < g_nWeaponData[nWeaponIdx][1]; i++ )
        give_item( id, g_szAmmoList[g_nWeaponData[nWeaponIdx][0]] )

    return
}

stock GivePlayerExtra( id, nExtraIdx )
{
    if( !is_user_alive(id) || (nExtraIdx < 0) || (nExtraIdx >= MO_MAX_EXTRA) )
        return

    new i, j
    switch( nExtraIdx )
    {
        case 0:   // Give Player All Weapons (+Ammo)
        {
            for( i = 0; i < MAX_WEAPONS; i++ )
            {
                give_item( id, g_szWeaponList[i] )
                for( j = 0; j < g_nWeaponData[i][1]; j++ )
                    give_item( id, g_szAmmoList[g_nWeaponData[i][0]] )
            }
        }
        case 1:   // Give Player M3 Set
        {
            GivePlayerWeapon( id, 6 )   // [6] = M3
            GivePlayerWeapon( id, 2 )   // [2] = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 2:   // Give Player MP5 Navy Set
        {
            GivePlayerWeapon( id, 8 )   // [8] = MP5 Navy
            GivePlayerWeapon( id, 2 )   // [2] = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 3:   // Give Player Clarion Set
        {
            GivePlayerWeapon( id, 13 )  // [13] = Clarion (Famas)
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 4:   // Give Player Galil Set
        {
            GivePlayerWeapon( id, 22 )  // [22] = Galil
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 5:   // Give Player M4A1 Set
        {
            GivePlayerWeapon( id, 16 )  // [16] = M4A1
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 6:   // Give Player AK47 Set
        {
            GivePlayerWeapon( id, 15 )  // [15] = AK47
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 7:   // Give Player Krieg SG552 Set
        {
            GivePlayerWeapon( id, 14 )  // [14] = Krieg SG552
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 8:   // Give Player Bullpup Set
        {
            GivePlayerWeapon( id, 17 )  // [17] = Bullpup
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 9:   // Give Player M249 Set
        {
            GivePlayerWeapon( id, 23 )  // [23] = M249
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 10:   // Give Player Scout Set
        {
            GivePlayerWeapon( id, 16 )  // [18] = Scout
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 11:   // Give Player AutoSniper Set
        {
            GivePlayerWeapon( id, 20 )    // [20] = CT AutoSniper (G3SG1)
            //GivePlayerWeapon( id, 21 )  // [21] = T AutoSniper (SG550)
            GivePlayerWeapon( id, 2 )     // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 12:   // Give Player AWP Set
        {
            GivePlayerWeapon( id, 19 )  // [19] = AWP
            GivePlayerWeapon( id, 2 )   // [2]  = Deagle
            for( i = 1; i < 6; i++ )
                GivePlayerItem( id, i ) // Kevlar, Flash/HE/Smoke Grenade, Defuse Kit
        }
        case 13:   // Give Player Nades Set
        {
            for( i = 2; i < 5; i++ )
                GivePlayerItem( id, i ) // Flash/HE/Smoke Grenades
        }
    }
    return
}

stock GivePlayerItem( id, nItemIdx )
{
    if( !is_user_alive(id) || (nItemIdx < 0) || (nItemIdx >= MAX_ITEMS) )
        return // Invalid User or Item

    if( (nItemIdx == 4) && (get_cvar_num("sv_weaponmenu_smoke") < 1) )
        return // Smoke Nades Restricted

    if( nItemIdx == 2 ) // If item is Flashbang, give it twice
        give_item( id, g_szItemsList[nItemIdx] )
    give_item( id, g_szItemsList[nItemIdx] )

    return
}

stock GivePrimaryAmmo( id )
{
    new nWeapons[32], nNum, i, j, k
    new szWeaponName[32]

    // Only give Primary Ammo for Guns Carried
    get_user_weapons( id, nWeapons, nNum )
    for( i = 0; i < nNum; i++ )
    {
        get_weaponname( nWeapons[i], szWeaponName, 31 )
        for( j = OFFSET_SHOTGUN; j < MAX_WEAPONS; j++ )
        {
            if( equali( szWeaponName, g_szWeaponList[j] ) )
            {
                for( k = 0; k < g_nWeaponData[j][1]; k++ )
                    give_item( id, g_szAmmoList[g_nWeaponData[j][0]] )
            }
        }
    }
    return
}

stock GiveSecondaryAmmo( id )
{
    new nWeapons[32], nNum, i, j, k
    new szWeaponName[32]

    // Only give Secondary Ammo for Pistols Carried
    get_user_weapons( id, nWeapons, nNum )
    for( i = 0; i < nNum; i++ )
    {
        get_weaponname( nWeapons[i], szWeaponName, 31 )
        for( j = 0; j < OFFSET_SHOTGUN; j++ )
        {
            if( equali( szWeaponName, g_szWeaponList[j] ) )
            {
                for( k = 0; k < g_nWeaponData[j][1]; k++ )
                    give_item( id, g_szAmmoList[g_nWeaponData[j][0]] )
            }
        }
    }
    return
}
//
//
///////////////////////////////////////////////////////////////////////////////////////////
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Bo_OT?!
сообщение 1.5.2011, 16:01
Сообщение #2


Стаж: 17 лет

Сообщений: 316
Благодарностей: 82
Полезность: 71

1. Fun модуль включи.
2.
CODE

#include <amxmodx>
#include <csx>
#include <hamsandwich>
#include <nvault>
#include <chatcolor>

#define VERSION "0.3.0"

#define ENABLED_BY_DEFAULT 1
#define NVAULT_MAX_DAYS_SAVE 30

#define MAX_PLAYERS 32
#define AUTHID_LENGTH 22
#define A_DAY_IN_SECONDS 86400 // 60 * 60 * 24

new g_szSteamId[MAX_PLAYERS+1][AUTHID_LENGTH]

new g_iOldRank[MAX_PLAYERS+1]
new g_bEnabled[MAX_PLAYERS+1]

new g_iNvault
new g_pCvarInfoRank

public plugin_init()
{
register_plugin("Info Rank", VERSION, "ConnorMcLeod")
register_dictionary("inforank.txt")

g_pCvarInfoRank = register_cvar("amx_inforank", "1")

RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1)

register_clcmd("say /inforank", "ClientCommand_InfoRank", 0, "- enable/disable info rank messages")
register_clcmd("say_team /inforank", "ClientCommand_InfoRank", 0, "- enable/disable info rank messages")

g_iNvault = nvault_open("inforank")
nvault_prune(g_iNvault, 0, get_systime(-(A_DAY_IN_SECONDS * NVAULT_MAX_DAYS_SAVE)) )
}

public client_authorized(id)
{
get_user_authid(id, g_szSteamId[id], charsmax(g_szSteamId[]))
if( g_szSteamId[id][0] == 'S' )
{
new mOsef[8]
g_iOldRank[id] = get_user_stats(id, mOsef, mOsef)

new szEnable[2]
nvault_get(g_iNvault, g_szSteamId[id], szEnable, charsmax(szEnable))

if(!szEnable[0])
{
g_bEnabled[id] = ENABLED_BY_DEFAULT
}
else
{
g_bEnabled[id] = str_to_num(szEnable)
}
}
}

public plugin_end()
{
nvault_close(g_iNvault)
}

public Player_Spawn_Post(id)
{
if( g_bEnabled[id]
&& is_user_alive(id)
&& get_pcvar_num(g_pCvarInfoRank) )
{
new mOsef[8], iRank, iOldRank
iRank = get_user_stats(id, mOsef, mOsef)

iOldRank = g_iOldRank[id]
if(iOldRank == 0)
{
iOldRank = iRank
}
g_iOldRank[id] = iRank

new iDiff = iOldRank - iRank

if(iDiff > 0)
{
client_print_color(id, DontChange, "%L", id, "IR_GOOD", iDiff)
}
else if(iDiff < 0)
{
client_print_color(id, Red, "%L", id, "IR_BAD", iDiff)
}
client_print_color(id, Blue, "%L", id, "IR_RANK", iRank, get_statsnum())
}
}

public ClientCommand_InfoRank(id)
{
if( get_pcvar_num(g_pCvarInfoRank) )
{
if( (g_bEnabled[id] = !g_bEnabled[id]) )
{
nvault_set(g_iNvault, g_szSteamId[id], "1")
client_print_color(id, DontChange, "%L", id, "IR_ENABLE")
}
else
{
nvault_set(g_iNvault, g_szSteamId[id], "0")
client_print_color(id, Red, "%L", id, "IR_DISABLE")
}
}
return PLUGIN_CONTINUE
}

Языковой файлик.
Цитата
[ru]
IR_GOOD = [Ранк] Ты поднялся(ася) на %i место!!
IR_BAD = [Ранк] Блин, ты опустился(ася) на %i место !!
IR_RANK = [Ранк] Твой ранг : %i из %i!
IR_ENABLE = [Ранк] Ты включил(а) сообщения.
IR_DISABLE = [Ранк] Ты выключил(а) сообщения.

[en]
IR_GOOD = [Info rank] Congratulations, you have advanced %i place(s) !!
IR_BAD = [Info rank] Noob, you have gone down %i place(s) !!
IR_RANK = [Info rank] Your rank : %i of %i
IR_ENABLE = [Info rank] You have enabled messages
IR_DISABLE = [Info rank] You have disabled messages


Отредактировал: Fill1993, - 1.5.2011, 16:13
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 1.5.2011, 17:31
Сообщение #3
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

ощибку выдает((
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 1.5.2011, 17:54
Сообщение #4
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

не компюлируеться
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя ProxXx
сообщение 1.5.2011, 20:43
Сообщение #5


Стаж: 19 лет

Сообщений: 72
Благодарностей: 41
Полезность: 438

Цитата(Fill1993 @ 1.5.2011, 16:01) *
1. Fun модуль включи.

Он включен, оно ругаеться что не может создать ammo_308, которо и вприроде нету в К.С.
http://wiki.amxmodx.org/CS_Weapons_Information
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bo_OT?!
сообщение 1.5.2011, 23:35
Сообщение #6


Стаж: 17 лет

Сообщений: 316
Благодарностей: 82
Полезность: 71

Цитата(kavkaz @ 1.5.2011, 18:31) *
ощибку выдает((

Цитата(kavkaz @ 1.5.2011, 18:54) *
не компюлируеться

Так. Ошибку выдаёт из-за отсутствия инклуда колорчата
Помещаешь на свой сервер с заменой. Добавил скачанный с Alliedmods плагин weaponmenu
Прикрепленный файл  cstrike.rar ( 32,51 килобайт ) Кол-во скачиваний: 16

Добавляешь в plugins.ini colorchat.amxx
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 2.5.2011, 7:09
Сообщение #7
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

спс ша оценю
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 2.5.2011, 8:18
Сообщение #8
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

Код
L 05/02/2011 - 09:23:08: Start of error session.
Info (map "awp_dust") (file "addons/amxmodx/logs/error_20110502.log")
[AMXX] Plugin needs newer debug version info (plugin "weaponmenu.amxx")
Start of error session.
Info (map "de_dustvsaztec") (file "addons/amxmodx/logs/error_20110502.log")
[AMXX] Plugin needs newer debug version info (plugin "weaponmenu.amxx")
Info (map "awp_dust") (file "addons/amxmodx/logs/error_20110502.log")
[AMXX] Plugin needs newer debug version info (plugin "weaponmenu.amxx")
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Yes I Do Not
сообщение 2.5.2011, 8:34
Сообщение #9


Стаж: 15 лет

Сообщений: 260
Благодарностей: 68
Полезность: 220

Глянь Этот Прикрепленный файл  weaponmenu.amxx.rar ( 23,02 килобайт ) Кол-во скачиваний: 24
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 2.5.2011, 8:56
Сообщение #10
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

ша проверю
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя kavkaz
сообщение 3.5.2011, 19:42
Сообщение #11
Стаж: 15 лет

Сообщений: 108
Благодарностей: 4
Полезность: 37

еше помогите испраить один плагин
Код
[CSTRIKE] Invalid player 5
[AMXX] Displaying debug trace (plugin "amx_adminmodel.amxx")
[AMXX] Run time error 10: native error (native "cs_get_user_team")
[AMXX]    [0] amx_adminmodel.sma::resetModel (line 74)

*sma
Код
/*##########################################################################
##
## -- www.SteamTools.net
##      ___   _____       ___  ___   _   __   _            ___  ___   _____   _      
##     /   | |  _  \     /   |/   | | | |  \ | |          /   |/   | |  _  \ | |      
##    / /| | | | | |    / /|   /| | | | |   \| |         / /|   /| | | | | | | |      
##   / / | | | | | |   / / |__/ | | | | | |\   |        / / |__/ | | | | | | | |      
##  / /  | | | |_| |  / /       | | | | | | \  |       / /       | | | |_| | | |___  
## /_/   |_| |_____/ /_/        |_| |_| |_|  \_|      /_/        |_| |_____/ |_____|
##                                                        
##          |__                   |__  o _|_   ___   __ __  o |__,  ___  
##      --  |__) (__|     (__(__( |  ) |  |_, (__/_ |  )  ) | |  \ (__/_
##                  |                                                    
##
##   Originated as a simple idea back in 2004, it was forgotten due to
## lack of my 'Small' coding skills. However I have progressed in recent
## months and somehow crossed that old post with this concept in it. So
## naturally I challenged myself to see if I could do it, and voila! I
## could :)
##
##   Once you join, you play a normal person for the first round, and for
## all remaining rounds your CT or TE models are custom. They now read
## "ADMIN" on front and back, and also have small "A" patches on the arms.
## I designed these models myself, it's very easy, just bring the textures
## into photoshop, tweak out, and replace.
##
##   Enjoy!
##
##
## CHANGELOG
##------------------------------------------------------------------------
## 2) v1.1.1 - Fixed missing event
## 1) v1.1.0 - Fixed VIP and other model bugs
##
##
## INSTALLATION
##------------------------------------------------------------------------
## 1) Unzip (which you may have done already)
## 2) Place 'amx_adminmodel.amxx' in 'cstrike/addons/amxmodx/plugins'
## 3) Add a line in 'configs/plugins.ini' containing 'amx_adminmodel.amxx'
## 4) Put the 'admin_ct' and 'admin_te' folders into 'cstrike/models' folder
## 5) -- Visit www.SteamTools.net and enjoy your new plugin!
##
##
##
## THE CVARs
##------------------------------------------------------------------------
##
## No CVARs for this plugin :)
##
##
##########################################################################*/    


#include <amxmodx>
#include <amxmisc>
#include <cstrike>

public plugin_init() {
        register_plugin("AMX Admin Model", "1.1.1", "whitemike")
        register_event("ResetHUD", "resetModel", "b")
        return PLUGIN_CONTINUE
}

public plugin_precache() {
        precache_model("models/player/nkav_ct/nkav_ct.mdl")
        precache_model("models/player/nkav_t/nkav_t.mdl")

        return PLUGIN_CONTINUE
}

public resetModel(id, level, cid) {
        if (get_user_flags(id) & ADMIN_KICK) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "nkav_t")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "nkav_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
        }

        return PLUGIN_CONTINUE
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: