Русское сообщество по скриптингу

Не работает плагин после перевода на русский

Все вопросы по скриптингу для AMXX, помощь в редактировании плагинов.

Модераторы: Subb98, liFe iS GoOD

Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающие только скриптинга для AMX Mod X.

Правила при создании новой темы:
1. При вставке кода плагина необходимо использовать тег [code=php].
2. Любые изображения должны быть загружены, как вложения к вашему сообщению.
3. При описании проблемы или запросе на помощь в редактировании плагина обязательно выкладывайте исходник sma плагина.

Не работает плагин после перевода на русский

Сообщение pro100-bad » 22 май 2018, 20:51

Полностью код плагина:
Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <money_ul>

//#define DEBUGGING 1

//
//DON'T EDIT THESE
//
#define T_BUY       0
#define T_PICK      1
#define T_PLANT     3
#define T_GOGGLES   5
#define T_BACK      8
#define T_EXIT      9

#define T_BURY      0
#define T_SLAP      1
#define T_DEATH     2
#define T_BLIND     3
#define T_SLOW      4
#define T_MATH      5
#define T_DRUG      6
#define T_HICCUP    7

#define NUMBER_OF_TRAPS 8

#define TASK_PLANT   16000
#define TASK_MOVE    16100
#define TASK_NOTICE  16200
#define TASK_BURY    500
#define TASK_SLOW    600
#define TASK_DRUG    700
#define TASK_MATH    800
#define TASK_HICCUP  900
#define TASK_PLAYHIC 1000

#define WAIT_TIME   30.0

#define T_MAX_ROUND 256

#define OP_ADD      0
#define OP_SUBTRACT 1
#define OP_MULTIPLY 2
#define OP_DIVIDE   3

new operators[4][2] = {
    "+", 
    
"-", 
    
"*", 
    
"/"
}

//
// Message to be printed into chat when a trap is bought and when it is used.
//
#define BUY_MESS "[AMXX TRAPS] You now have %d %s Trap(s) and %d total Trap(s)"

//
// REM THIS OUT IF YOU DON'T WANT IT TO SHOW ON THE SCREEN WHEN SOMEONE JOINS
//
#define T_NOTICE "[AMXX TRAPS] To bring up the traps menu, type /traps"

//
// Global declarations...
//
new MenuKeys = (<< 0) + (<< 1) + (<< 2) + (<< 3) + (<< 4) + (<< 5) + (<< 6) + (<< 7) + (<< 8) + (<< 9)
new MainMenuKeys = (<< 0) + (<< 1) + (<< 3) + (<< 5) + (<< 9)
new BuyMenuBodyText[256]
new PickMenuBodyText[256]
new MainMenuBodyText[256]

new bool:is_buyzone[32] = true

new pTraps
[32]
new pTrapsRound[32]
new pTrapTypes[32][NUMBER_OF_TRAPS]
new pPickedTrap[32]
new pPickedTrapString[32][32]
new pTotalTrapsPlanted
new pTrapOrigins
[T_MAX_ROUND][3]
new pTrapOwner[T_MAX_ROUND]
new pTrapType[T_MAX_ROUND]

new spriteTrap[8]
new spriteQMark

new bool
:pTrapActive[T_MAX_ROUND]
new bool:is_blind[32] = false
new bool
:is_slow[32] = false
new bool
:is_bury[32] = false
new bool
:is_planting[32] = false
new bool
:is_drugged[32] = false
new bool
:is_math[32] = false
new bool
:is_hiccup[32] = false
new bool
:is_goggle[32] = false
new mathAnswer
[32]
new mathEquations[32][128]
new mathLastGuess[32] = -1
new mathLastGuess2
[32] = -1

new buryOrigins
[32]
new Float:user_speed[32] = 250.0
new CsTeams
:pTrapOwnerTeam[T_MAX_ROUND]

new soundPlant[] = "weapons/c4_plant.wav"
new soundJeopardy[] = "traps/jeopardy.wav"

new soundHiccups[3][19] = {
    "traps/hiccup.wav",
    "traps/hiccup2.wav",
    "traps/hiccup3.wav"
}

new spriteTraps[8][29] = {
    "sprites/traps/trap1.spr",
    "sprites/traps/trap2.spr",
    "sprites/traps/trap3.spr",
    "sprites/traps/trap4.spr",
    "sprites/traps/trap5.spr",
    "sprites/traps/trap6.spr",
    "sprites/traps/trap7.spr",
    "sprites/traps/trap8.spr"
}

//
// FUNCTIONS AND EVENTS START HERE!!!!!!!!!
//
public plugin_init()
{
    register_plugin("Set Traps", "v1.0", "xx_sirhc_xx")

    register_concmd("amx_traps", "ConCmdTraps", ADMIN_KICK, "- <0|1 = OFF/ON>")

    register_clcmd("say", "ClCmdSay", -1, "- Say")

        register_clcmd("say /traps", "ClCmdTraps", -1, "- Traps Menu")

    register_event("StatusIcon", "Event_BuyZone", "be", "2=buyzone")
    register_event("DeathMsg", "Event_Death", "a")
    register_event("HLTV", "Event_Restart", "a", "1=0", "2=0") 
    register_event
("ScreenFade", "Event_ScreenFade", "b")
    register_event("CurWeapon", "eventCurWeapon", "be");

    register_cvar("traps_bury", "1")
    register_cvar("traps_slap", "1")
    register_cvar("traps_death", "1")
    register_cvar("traps_blind", "1")
    register_cvar("traps_hiccup", "1")
    register_cvar("traps_slow", "1")
    register_cvar("traps_drug", "1")
    register_cvar("traps_math", "1")
    register_cvar("traps_enable", "1")
    register_cvar("traps_goggle", "1")
    register_cvar("traps_max", "3")             //max traps that can be bought per round
    register_cvar("traps_radius", "50")
    register_cvar("traps_buyzone", "1")         //set to 0 for users to buy traps anywhere
    register_cvar("traps_price_bury", "8000")
    register_cvar("traps_price_slap", "2000")
    register_cvar("traps_price_death", "14000")
    register_cvar("traps_price_blind", "10000")
    register_cvar("traps_price_slow", "5000")
    register_cvar("traps_price_drug", "10000")
    register_cvar("traps_price_math", "7000")
    register_cvar("traps_price_hiccup", "8000")
    register_cvar("traps_price_goggle", "4000")

    SetupBuyMenu()
        SetupMainMenu()

    register_menucmd(register_menuid("\rTraps!"), MainMenuKeys, "Traps")
    register_menucmd(register_menuid("\rPick the trap to plant"), MenuKeys, "PickIt")
    register_menucmd(register_menuid("\rBuy Traps"), MenuKeys, "BuyIt")
}

public ConCmdTraps(id, level, cid)
{
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    new pArg
[32]
    read_argv(1, pArg, 31)

    new OnOff = str_to_num(pArg)

    if (!OnOff)
    {
        set_cvar_num("traps_enable", 0)
        console_print(id, "[AMXX TRAPS] Traps have been Disabled")
        client_print(0, print_chat, "[AMXX TRAPS] Admin has DISABLED Traps")
    }
    else
    
{
        set_cvar_num("traps_enable", 1)
        console_print(id, "[AMXX TRAPS] Traps have been Enabled")
        client_print(0, print_chat, "[AMXX TRAPS] Admin has ENABLED Traps")
    }

    return PLUGIN_HANDLED
}

public plugin_precache()
{
    precache_sound(soundPlant)
    precache_sound(soundJeopardy)

    for (new i = 0; i < 3; i++)
        precache_sound(soundHiccups[i])

    for (new i = 0; i < 8; i++)
        spriteTrap[i] = precache_model(spriteTraps[i])

    spriteQMark = precache_model("sprites/traps/QMark.spr")
}

public client_putinserver(id)
{
    new pArgs[2]
    pArgs[0] = id

    
#if defined T_NOTICE
        set_task(15.0, "ShowNotice", (TASK_NOTICE + id), pArgs, 1)
    #endif

    ResetPlayerVariables(id)
}

public client_disconnect(id)
    ResetPlayerVariables(id)

public ShowNotice(pArgs[])
{
    new id = pArgs[0]

    set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
    show_hudmessage(id, T_NOTICE)
}

public Event_Restart()
{
    pTotalTrapsPlanted = 0

    for 
(new z = 1; z < 33; z++)
        ResetMostPlayerVariables(z)

    return PLUGIN_CONTINUE
}

public eventCurWeapon(id)
{

    if (is_slow[id - 1] || is_math[id - 1])
    {
        new Float:speed = user_speed[id - 1]
        set_user_maxspeed(id, speed)
    }
}

public ResetPlayerVariables(id)
{

    pTraps[id - 1] = 0
    pTrapsRound
[id - 1] = 0
    is_blind
[id - 1] = false
        is_slow
[id - 1] = false
    is_bury
[id - 1] = false
        is_planting
[id - 1] = false
    is_math
[id - 1] = false
    is_drugged
[id - 1] = false
    is_hiccup
[id - 1] = false
    is_goggle
[id - 1] = false

    mathLastGuess
[id - 1] = -1
    mathLastGuess2
[id - 1] = -1

    for 
(new i = 0; i < NUMBER_OF_TRAPS; i++)
        pTrapTypes[id - 1][i] = 0

    user_speed
[id - 1] = 250.0

        buryOrigins
[id - 1] = 0

    for 
(new i = 0; i < 5; i++)
        pTrapTypes[id - 1][i] = 0

    pPickedTrap
[id - 1] = -1

}

public ResetMostPlayerVariables(id)
{

    pTrapsRound[id - 1] = 0

    is_blind
[id - 1] = false
        is_slow
[id - 1] = false
    is_bury
[id - 1] = false
        is_planting
[id - 1] = false
    is_math
[id - 1] = false
    is_drugged
[id - 1] = false
    is_hiccup
[id - 1] = false
    is_goggle
[id - 1] = false

    mathLastGuess
[id - 1] = -1
    mathLastGuess2
[id - 1] = -1

    user_speed
[id - 1] = 250.0

        buryOrigins
[id - 1] = 0

}

public Event_Death()
{
    if (!get_cvar_num("traps_enable"))
        return PLUGIN_CONTINUE

    new id 
= read_data(2)

    if (task_exists(id))
        remove_task(id)

        if (task_exists(id + TASK_DRUG))
                remove_task(id + TASK_DRUG)

        if (task_exists(id + TASK_MATH))
                remove_task(id + TASK_MATH)

        if (task_exists(id + TASK_SLOW))
                remove_task(id + TASK_SLOW)

        if (task_exists(id + TASK_BURY))
                remove_task(id + TASK_BURY)

        if (task_exists(id + TASK_PLANT))
                remove_task(id + TASK_PLANT)

        if (task_exists(id + TASK_MOVE))
                remove_task(id + TASK_MOVE)

    if (task_exists(id + TASK_HICCUP))
        remove_task(id + TASK_HICCUP)

    if (task_exists(id + TASK_PLAYHIC))
        remove_task(id + TASK_PLAYHIC)


    ResetPlayerVariables(id)

    return PLUGIN_CONTINUE
}




/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  BUYING TRAPS    \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when the user types "/buytrap" into chat
//
public ClCmdBuyTrap(id)
{
    SetupBuyMenu()
    show_menu(id, MenuKeys, BuyMenuBodyText)

    return PLUGIN_HANDLED
}

//
// This is called when the user types "/traps" into chat
//
public ClCmdTraps(id)
{
    SetupMainMenu()
    show_menu(id, MainMenuKeys, MainMenuBodyText)

    return PLUGIN_HANDLED
}

//
// This is called when the user tries to buy a trap from the menu
//
public BuyIt(id, key)
{
    switch (key)
    {
        case T_BURY:
            if (canBuy(id, "bury"))
                BuyTrap(id, T_BURY, "Bury", get_cvar_num("traps_price_bury"))

        case T_SLAP:
            if (canBuy(id, "slap"))
                BuyTrap(id, T_SLAP, "Slap", get_cvar_num("traps_price_slap"))

        case T_DEATH:
            if (canBuy(id, "death"))
                BuyTrap(id, T_DEATH, "Death", get_cvar_num("traps_price_death"))

        case T_BLIND:
            if (canBuy(id, "blind"))
                BuyTrap(id, T_BLIND, "Blind", get_cvar_num("traps_price_blind"))

        case T_HICCUP:
            if (canBuy(id, "hiccup"))
                BuyTrap(id, T_HICCUP, "Hiccup", get_cvar_num("traps_price_hiccup"))

        case T_SLOW:
            if (canBuy(id, "slow"))
                BuyTrap(id, T_SLOW, "Slow", get_cvar_num("traps_price_slow"))

        case T_MATH:
            if (canBuy(id, "math"))
                BuyTrap(id, T_MATH, "Math", get_cvar_num("traps_price_math"))

        case T_DRUG:
            if (canBuy(id, "drug"))
                BuyTrap(id, T_DRUG, "Drug", get_cvar_num("traps_price_drug"))

                case T_BACK:
        {
                          ClCmdTraps(id)
            return PLUGIN_HANDLED
        
}
    
        case T_EXIT
:
            return PLUGIN_HANDLED
    
}

    ClCmdBuyTrap(id)
    return PLUGIN_HANDLED
}

public ClCmdBuyGoggles(id)
{

    if (!get_cvar_num("traps_enable"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Admin has disabled Traps!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    if (!get_cvar_num("traps_goggle"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Trap goggles are disabled!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    if (!is_user_alive(id))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Dead people don't buy goggles!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    if ((!is_buyzone[id - 1]) && (get_cvar_num("traps_buyzone") != 0))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You must be in a buyzone to buy goggles!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    if (is_goggle[id - 1])
    {
        client_print(id, print_chat, "[AMXX TRAPS] You already have trap goggles!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    if ((cs_get_user_money_ul(id)) < (get_cvar_num("traps_price_goggle")))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You don't have enough money for goggles!")
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    is_goggle[id - 1] = true

    new Money 
= cs_get_user_money_ul(id)
    cs_set_user_money_ul(id, Money - get_cvar_num("traps_price_goggle"))

    client_print(id, print_chat, "[AMXX TRAPS] You now have trap goggles for the round!")
    ClCmdTraps(id)

    return PLUGIN_HANDLED
}

public Traps(id, key)
{
    switch (key)
    {
        case T_BUY:
            ClCmdBuyTrap(id)

        case T_PICK:
            ClCmdPickTrap(id)

        case T_GOGGLES:
            ClCmdBuyGoggles(id)

        case T_PLANT:
        {
            ClCmdSetTrap(id)
                          SetupMainMenu()
                    show_menu(id, MainMenuKeys, MainMenuBodyText)
        }
    }

    return PLUGIN_HANDLED
}

//
// This buys the trap
//
public BuyTrap(id, tType, tName[], tPrice)
{
    pTraps[id - 1]++
    pTrapsRound[id - 1]++
    pTrapTypes[id - 1][tType]++

    new Money = cs_get_user_money_ul(id)
    cs_set_user_money_ul(id, Money - tPrice)

    if (pPickedTrap[id - 1] == -1)
    {
        pPickedTrap[id - 1] = tType
        format
(pPickedTrapString[id - 1], 31, "%s", tName)
    }

    client_print(id, print_chat, BUY_MESS, pTrapTypes[id - 1][tType], tName, pTraps[id - 1])

    SetupBuyMenu()
    show_menu(id, MenuKeys, BuyMenuBodyText)

    return 1
}

//
// This event is called when a user enters/exits a buy zone
//
public Event_BuyZone(id)
{
    if (read_data(1))
        is_buyzone[id - 1] = true
    else
        is_buyzone
[id - 1] = false

    return PLUGIN_CONTINUE
}

//
// This boolean is used to check if a user can buy the trap
//
public bool:canBuy(id, cvarName[])
{
    new cvarNameEnable[32]
    new cvarPriceCheck[32]

    format(cvarNameEnable, 31, "traps_%s", cvarName)
    format(cvarPriceCheck, 31, "traps_price_%s", cvarName)

    if (!get_cvar_num("traps_enable"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Admin has disabled Traps!")
        return false
    
}

    if (!get_cvar_num(cvarNameEnable))
    {
        client_print(id, print_chat, "[AMXX TRAPS] This Trap is disabled!")
        return false
    
}

    if (!is_user_alive(id))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Dead people don't buy Traps!")
        return false
    
}

    if ((!is_buyzone[id - 1]) && (get_cvar_num("traps_buyzone") != 0))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You must be in a buyzone to buy a Trap!")
        return false
    
}

    if (pTrapsRound[id - 1] >= get_cvar_num("traps_max"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You already have the max amount of Traps this round!")
        return false
    
}

    if ((cs_get_user_money_ul(id)) < (get_cvar_num(cvarPriceCheck)))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You don't have enough money for this Trap!")
        return false
    
}

    return true
}

/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  PICKING TRAPS   \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when a player types "/picktrap" into chat
//
public ClCmdPickTrap(id)
{
    SetupPickMenu(id)
    show_menu(id, MenuKeys, PickMenuBodyText)

    return PLUGIN_HANDLED
}

//
// This is called when a user tries to pick a Trap to be planted
//
public PickIt(id, key)
{
    switch (key)
    {
        case T_BURY:
            if (canPick(id, "bury", T_BURY))
            {
                pPickedTrap[id - 1] = T_BURY
                pPickedTrapString
[id - 1] = "Bury"
                client_print(id, print_chat, "[AMXX TRAPS] The Bury Trap is now picked!");
            }

        case T_SLAP:
            if (canPick(id, "slap", T_SLAP))
            {
                pPickedTrap[id - 1] = T_SLAP
                pPickedTrapString
[id - 1] = "Slap"
                client_print(id, print_chat, "[AMXX TRAPS] The Slap Trap is now picked!");
            }

        case T_DEATH:
            if (canPick(id, "death", T_DEATH))
            {
                pPickedTrap[id - 1] = T_DEATH
                pPickedTrapString
[id - 1] = "Death"
                client_print(id, print_chat, "[AMXX TRAPS] The Death Trap is now picked!");
            }

        case T_BLIND:
            if (canPick(id, "blind", T_BLIND))
            {
                pPickedTrap[id - 1] = T_BLIND
                pPickedTrapString
[id - 1] = "Blind"
                client_print(id, print_chat, "[AMXX TRAPS] The Blind Trap is now picked!");
            }

        case T_HICCUP:
            if (canPick(id, "hiccup", T_HICCUP))
            {
                pPickedTrap[id - 1] = T_HICCUP
                pPickedTrapString
[id - 1] = "Hiccup"
                client_print(id, print_chat, "[AMXX TRAPS] The Hiccup Trap is now picked!");
            }

        case T_SLOW:
            if (canPick(id, "slow", T_SLOW))
            {
                pPickedTrap[id - 1] = T_SLOW
                pPickedTrapString
[id - 1] = "Slow"
                client_print(id, print_chat, "[AMXX TRAPS] The Slow Trap is now picked!");
            }

        case T_MATH:
            if (canPick(id, "math", T_MATH))
            {
                pPickedTrap[id - 1] = T_MATH
                pPickedTrapString
[id - 1] = "Math"
                client_print(id, print_chat, "[AMXX TRAPS] The Math Trap is now picked!");
            }

        case T_DRUG:
            if (canPick(id, "drug", T_DRUG))
            {
                pPickedTrap[id - 1] = T_DRUG
                pPickedTrapString
[id - 1] = "Drug"
                client_print(id, print_chat, "[AMXX TRAPS] The Drug Trap is now picked!");
            }

        case T_BACK:
        {
            ClCmdTraps(id)
            return PLUGIN_HANDLED
        
}

        case T_EXIT:
            return PLUGIN_HANDLED
    
}

        ClCmdPickTrap(id)
    return PLUGIN_HANDLED
}

//
// This boolean checks to see if the player can Pick the selected Trap
//
public bool:canPick(id, tName[], pType)
{
    new cvarNameEnable[32]

    format(cvarNameEnable, 31, "traps_%s", tName)

    if (!get_cvar_num("traps_enable"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Admin has disabled traps!")
        return false
    
}

    if (!get_cvar_num(cvarNameEnable))
    {
        client_print(id, print_chat, "[AMXX TRAPS] This Trap is disabled!")
        return false
    
}

    if (!pTrapTypes[id - 1][pType])
    {
        client_print(id, print_chat, "[AMXX TRAPS] You have no %s Traps!", tName)
        return false
    
}

    return true
}







/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  PLANTING TRAPS  \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when a user pushes a key bound to "+settrap"
//
public ClCmdSetTrap(id)
{
    if (!canPlant(id))
    {
        ClCmdTraps(id)
        return PLUGIN_HANDLED
    
}

    //
    // Progress Bar (Activate) -- This was taken almost directly from xeroblood!
    //
    message_begin( MSG_ONE, 108, {0,0,0}, id )
    write_byte(1)   // duration
    write_byte(0)   // duration
    message_end()

    new pID[2]
    pID[0] = id

        is_planting
[id - 1] = true
    set_task
(0.1, "CheckUserMoving", (TASK_MOVE + id), pID, 1)
    set_task(1.0, "PlantTrap", (TASK_PLANT + id), pID, 1)

    return PLUGIN_HANDLED;

}

//
// This is called when a user executes -settrap (let's go of the key bound to +settrap)
//
public ClCmdEndSetTrap(id)
{
    if (task_exists((TASK_PLANT + id)))
    {
        remove_task((TASK_PLANT + id))
        remove_task((TASK_MOVE + id))
    }

    //
    // Progress Bar (Terminate)
    //
    message_begin(MSG_ONE, 108, {0,0,0}, id)
    write_byte(0) // duration
    write_byte(0) // duration
    message_end()

    is_planting[id - 1] = false

    return PLUGIN_HANDLED
}

//
// This plants the Trap
//
public PlantTrap(pArgs[])
{
    new id = pArgs[0]

    if (task_exists((TASK_MOVE + id)))
        remove_task((TASK_MOVE + id))

    new pTot = pTotalTrapsPlanted
    new pTyp 
= pPickedTrap[id - 1]

    get_user_origin(id, pTrapOrigins[pTot], 0)
    pTrapOwner[pTot] = id
    pTrapOwnerTeam
[pTot] = cs_get_user_team(id)
    pTrapActive[pTot] = true
    pTrapType
[pTot] = pTyp
    
    pTraps
[id - 1]--
    pTrapTypes[id - 1][pTyp]--
    pTotalTrapsPlanted++

    if (pTrapTypes[id - 1][pTyp] <= 0)
    {
        pPickedTrap[id - 1] = -1
        for 
(new n = 0; n < NUMBER_OF_TRAPS; n++)
        {
            if (pTrapTypes[id - 1][n] > 0)
            {
                pPickedTrap[id - 1] = n
                break
;
            }
        }
    }

    emit_sound(id, CHAN_WEAPON, soundPlant, 1.0, ATTN_NORM, 0, PITCH_NORM)

        //set_user_maxspeed(id, user_speed[id - 1])
        is_planting[id - 1] = false

    client_print
(id, print_chat, "[AMXX TRAPS] Your Trap was planted successfully!")
    client_print(id, print_chat, BUY_MESS, pTrapTypes[id - 1][pTyp], pPickedTrapString[id - 1], pTraps[id - 1])

    //new origin[3]
    //new Float:vOrigin[3]

    //entity_get_vector(id, EV_VEC_origin, vOrigin)

    //get_user_origin(id, origin, 3);
    //IVecFVec(origin, vOrigin);

    //new ent = create_entity("info_target");
    //new Float:gfDefaultBlockAngles[3] = { 0.0, 0.0, 0.0 };
    //new Float:gfBlockSizeMinForZ[3] = {-16.0,-16.0,-2.0};
    //new Float:gfBlockSizeMaxForZ[3] = { 16.0, 16.0, 2.0};

    //if (is_valid_ent(ent))
    //{
    //    //set block properties
    //    entity_set_string(ent, EV_SZ_classname, "trap_flag");
    //    entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
    //    entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
    //    entity_set_model(ent, tehModel);
    //    entity_set_vector(ent, EV_VEC_angles, gfDefaultBlockAngles);
    //    entity_set_size(ent, gfBlockSizeMinForZ, gfBlockSizeMaxForZ);
    //    entity_set_origin(ent, vOrigin);
    //    set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransColor, 255)
    //    entity_set_int(ent, EV_INT_solid, SOLID_NOT);

    //    pTrapEntity[pTot] = ent
    //    pTrapEntityFlag[pTot] = true
    //    pTrapEntityTeam[pTot] = pev(id,pev_team)


    //}
    return PLUGIN_HANDLED
}

//
// Makes sure the player isn't moving while planting the Trap
//
public CheckUserMoving(pArgs[])
{
    new id = pArgs[0]
    
    if 
(!is_user_standing_still(id))
        ClCmdEndSetTrap(id)
    else
        set_task
(0.1, "CheckUserMoving", (TASK_MOVE + id), pArgs, 1)

    return PLUGIN_HANDLED
}

//
// This boolean checks if a player is able to plant a Trap
//
public bool:canPlant(id)
{

    if (!get_cvar_num("traps_enable"))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Admin has disabled Traps!")
        return false
    
}

    if (!is_user_alive(id))
    {
        client_print(id, print_chat, "[AMXX TRAPS] Dead people don't plant Traps!")
        return false
    
}

    if (!pTraps[id - 1])
    {
        client_print(id, print_chat, "[AMXX TRAPS] You have no Traps to plant!")
        return false
    
}

    if (pPickedTrap[id - 1] == -1)
    {
        client_print(id, print_chat, "[AMXX TRAPS] You have no Trap picked!")
        ClCmdPickTrap(id)
        return false
    
}

    if (!is_user_standing_still(id))
    {
        client_print(id, print_chat, "[AMXX TRAPS] You must be standing still to plant a Trap!")
        return false
    
}

    if (is_planting[id - 1] == true)
    {
        client_print(id, print_chat, "[AMXX TRAPS] You are already planting a trap!")
        return false
    
}

    return true

}

//
// This boolean makes sure a player is standing still (not jumping or moving!)
//
public bool:is_user_standing_still(id)
{
    if (get_user_button(id) & (IN_JUMP|IN_FORWARD|IN_BACK|IN_MOVELEFT|IN_MOVERIGHT))
        return false

    if 
(!(get_entity_flags(id) & FL_ONGROUND))
        return false

    return true
}

/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  CATCHING PLAYERS IN TRAPS   \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// Checks if the person is in a trap
//
public client_PostThink(id)
{
    new pOrigin[3];

    if (!is_user_alive(id))
        return PLUGIN_CONTINUE

    if 
(!get_cvar_num("traps_enable"))
        return PLUGIN_CONTINUE

    if 
(is_slow[id - 1])
    {
        new Float:speed = get_user_maxspeed(id)
        if (speed != user_speed[id - 1])
            set_user_maxspeed(id, user_speed[id - 1])

    }

    get_user_origin(id, pOrigin, 0);

    for (new i = 0; i < pTotalTrapsPlanted; i++)
    {
        if (pTrapActive[i])
        {
            #if !defined DEBUGGING

                new CsTeams:pTheTeam = cs_get_user_team(id)

                if ((pTrapOwner[i] == id) || (pTrapOwnerTeam[i] == pTheTeam))
                {
                    DrawSprite(id, i)
                } else if (is_goggle[id - 1]) {
                    DrawSpriteQ(id, i)
                }

                if ((pTrapOwner[i] != id) && (pTrapOwnerTeam[i] != pTheTeam) && (get_entity_flags(id) & FL_ONGROUND))
                {
                    new pDistance = get_distance(pOrigin, pTrapOrigins[i])

                    if (pDistance <= get_cvar_num("traps_radius"))
                    {

                        PunishUser(id, i)
                        //remove_entity(pTrapEntity[i])
                        //pTrapEntityFlag[i] = false
                    }
                }
            #else
                if ((get_entity_flags(id) & FL_ONGROUND))
                {
                    new pDistance = get_distance(pOrigin, pTrapOrigins[i])

                    if (pDistance <= get_cvar_num("traps_radius"))
                    {
                        PunishUser(id, i)
                    }
                }
            #endif
        }
    }

    return PLUGIN_CONTINUE
}

//
// Handle's the punishing of users
//

public DrawSprite(id, tNum)
{

    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
    write_byte(TE_SPRITE) // additive sprite, plays 1 cycle
    write_coord(pTrapOrigins[tNum][0]) // xpos
    write_coord(pTrapOrigins[tNum][1]) // ypos
    write_coord(pTrapOrigins[tNum][2]) // zpos
    write_short(spriteTrap[pTrapType[tNum]]) // spr index
    write_byte(1) // (scale in 0.1's)
    write_byte(20) //brightness
    message_end()

}
public DrawSpriteQ(id, tNum)
{

    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
    write_byte(TE_SPRITE) // additive sprite, plays 1 cycle
    write_coord(pTrapOrigins[tNum][0]) // xpos
    write_coord(pTrapOrigins[tNum][1]) // ypos
    write_coord(pTrapOrigins[tNum][2]) // zpos
    write_short(spriteQMark) // spr index
    write_byte(2) // (scale in 0.1's)
    write_byte(20) //brightness
    message_end()

}

public PunishUser(id, tNum)
{
    pTrapActive[tNum] = false

    switch 
(pTrapType[tNum])
    {
        case T_BURY:
                {
                        is_bury[id - 1] = true
            BuryUser
(id, tNum)
                }

        case T_SLAP:
        {
            HalfDamageUser(id, tNum)
            return PLUGIN_HANDLED
        
}
        case T_DEATH:
        {
            KillUser(id, tNum)
            return PLUGIN_HANDLED
        
}

        case T_BLIND:
        {    
            new pName
[32], aName[32]

            get_user_name(id, pName, 31)
            get_user_name(pTrapOwner[tNum], aName, 31)

            client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Blind Trap!  You are now blind!")
            client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Blind Trap!", pName, aName)

            is_blind[id - 1] = true

            BlindUser
(id)
        }

        case T_HICCUP:
        {
            HiccupUser(id, tNum)
            return PLUGIN_HANDLED
        
}

        case T_SLOW:
                {
                        is_slow[id - 1] = true
            SlowUser
(id, tNum)
                }

        case T_DRUG:
                {
                        is_drugged[id - 1] = true
            DrugUser
(id, tNum)
                }

        case T_MATH:
                {
            if (is_math[id - 1] == false)
                MathUser(id, tNum)
                }
    }
    set_user_rendering(id,kRenderFxGlowShell, 200,0,0, kRenderNormal,16);

    return PLUGIN_HANDLED
}

//
// Burys the user
//
public BuryUser(id, id2)
{
    new pOrigin[3], pName[32], aName[32]

    get_user_origin(id, pOrigin, 0)

        buryOrigins[id - 1] += 30

        is_bury
[id - 1] = true

    pOrigin
[2] -= 30;
    set_user_origin(id, pOrigin)

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Bury Trap!  You've been buried!")
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Bury Trap!", pName, aName)

    set_task(WAIT_TIME, "UnBuryUser", id + TASK_BURY)

    return 1
}

//
// Slaps the user's health in half
//
public HalfDamageUser(id, id2)
{
    new pName[32], aName[32]

    new Health = get_user_health(id)

    user_slap(id, (Health / 2), 1)

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Slap Trap!  Your Health was cut in half!")
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Slap Trap!", pName, aName)

    return 1
}

//
// Slow the user down
//
public SlowUser(id, id2)
{
    new pName[32], aName[32]

    new Float:speed = get_user_maxspeed(id) / 2

    set_user_maxspeed
(id, speed)

        user_speed[id - 1] = speed
        is_slow
[id - 1] = true

    get_user_name
(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Slow Trap!  Your Speed was cut in half!")
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Slow Trap!", pName, aName)

    set_task(WAIT_TIME, "UnSlowUser", id + TASK_SLOW)

    return 1
}

//
// Drug the user
//
public DrugUser(id, id2)
{
    new pName[32], aName[32]

        is_drugged[id - 1] = true

    message_begin
(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
    write_byte(170)
    message_end()

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Drug Trap!  You're a junkie!")
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Drug Trap!", pName, aName)

    set_task(WAIT_TIME, "UnDrugUser", id + TASK_DRUG)

    return 1
}

//
// "Math" the user
//
public MathUser(id, id2)
{
    new pName[32], aName[32], pOrigin[3]

        is_math[id - 1] = true

    set_user_maxspeed
(id, 0.1)
    user_speed[id - 1] = 0.1

    get_user_origin
(id, pOrigin, 0)
    pOrigin[2] -= 30;
    set_user_origin(id, pOrigin)

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_cmd(id, "spk %s", soundJeopardy)
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Math Trap!", pName, aName)
    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Math Trap!  Solve the equation!")
    client_print(id, print_chat, "[AMXX TRAPS] Solve for x.  Type the answer into chat when you figure it out!")

    cmdMath(id)

    return 1
}

//
// Kill's the user
//
public KillUser(id, id2)
{
    new pName[32], aName[32]

    user_kill(id)

    new aFrags = get_user_frags(id2 + 1)
    aFrags += 1
    set_user_frags
(id2 + 1, aFrags)

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Death Trap!  You were killed!")
    client_print((id2 + 1), print_chat, "[AMXX TRAPS] You killed %s with your Death trap!", aName)
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Death Trap!", pName, aName)

    return 1
}

//
// Blinds the user and initializes BlindTask to keep them blind
//
public BlindUser(id)
{
    message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
    write_short(1<<12)
    write_short(1<<8)
    write_short(1<<0)
    write_byte(0)
    write_byte(0)
    write_byte(0)
    write_byte(255)
    message_end()
    set_task(1.0, "BlindTask", id)
    set_task(WAIT_TIME, "UnBlindUser", id)
    return PLUGIN_CONTINUE
}

//
// Blinds the user
//
public BlindTask(id)
{
    if (is_blind[id - 1])
    {
        message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
        write_short(1<<0)
        write_short(1<<0)
        write_short(1<<2)
        write_byte(0)
        write_byte(0)
        write_byte(0)
        write_byte(255)
        message_end()
    }
}

public UnBlindUser(id)
{
    if (is_blind[id - 1])
    {
        new pName[32]

        message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id);     // use the magic #1 for "one client"  
        write_short( 1<<12 );     // fade lasts this long duration  
        write_short( 1<<);     // fade lasts this long hold time  
        write_short( 1<<);     // fade type
        write_byte( 0 );     // fade red  
        write_byte( 0 );     // fade green  
        write_byte( 0 );     // fade blue
        write_byte( 128 );     // fade alpha  
        message_end( );

        is_blind[id - 1] = false

        get_user_name
(id, pName, 31)
        client_print(0, print_chat, "[AMXX TRAPS] %s is no longer blind!", pName)

        set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
    }
}

public UnSlowUser(id)
{
    new pName[32]

        set_user_maxspeed(id - TASK_SLOW, 250.0)

        is_slow[(id - TASK_SLOW) - 1] = false
    user_speed
[(id - TASK_SLOW) - 1] = 250.0
    set_user_rendering
(id - TASK_SLOW,kRenderFxNone,255,255,255, kRenderNormal,16);

    get_user_name(id - TASK_SLOW, pName, 31)
    client_print(0, print_chat, "[AMXX TRAPS] %s's speed has returned to normal!", pName)

        if (task_exists(id))
                remove_task(id)
}

public UnDrugUser(id)
{
    new pName[32]

        set_user_maxspeed(id - TASK_DRUG, 250.0)

        is_drugged[(id - TASK_DRUG) - 1] = false
    set_user_rendering
(id - TASK_DRUG,kRenderFxNone,255,255,255, kRenderNormal,16);

    message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id - TASK_DRUG)
    write_byte(90)
    message_end()

    get_user_name(id - TASK_DRUG, pName, 31)
    client_print(0, print_chat, "[AMXX TRAPS] %s is no longer drugged!", pName)

        if (task_exists(id))
                remove_task(id)
}

public UnBuryUser(id, id2)
{
    new pOrigin[3], pName[32]

    get_user_origin(id - TASK_BURY, pOrigin, 0)
        pOrigin[2] += buryOrigins[(id - TASK_BURY) - 1]

    set_user_origin(id - TASK_BURY, pOrigin)
        buryOrigins[(id - TASK_BURY) - 1] = 0

        is_bury
[(id - TASK_BURY) - 1] = false
        set_user_rendering
(id - TASK_BURY,kRenderFxNone,255,255,255, kRenderNormal,16);

    get_user_name(id - TASK_BURY, pName, 31)
    client_print(0, print_chat, "[AMXX TRAPS] %s is no longer buried!", pName)

        if (task_exists(id))
                remove_task(id)
}
//
// This event is called on a ScreenFade
//
public Event_ScreenFade(id)
{
    set_task(0.6, "BlindTask", id)
    return PLUGIN_CONTINUE
}

//
// Hiccups the user
//
public HiccupUser(id, id2)
{
    new aName[32], pName[32]
    new r = random(5) + 1

    set_task
(float(r), "PlayHic", TASK_PLAYHIC + id)
    set_task(WAIT_TIME * 1.5, "UnHiccupUser", TASK_HICCUP + id)

    get_user_name(id, pName, 31)
    get_user_name(pTrapOwner[id2], aName, 31)

    client_print(id, print_chat, "[AMXX TRAPS] Oh No! You fell into a Hiccup Trap!  You have the hiccups!")
    client_print(0, print_chat, "[AMXX TRAPS] %s fell into %s's Hiccup Trap!", pName, aName)

    return 1
}

public PlayHic(id)
{
    new mid = id - TASK_PLAYHIC

    new Float
:velocity[3]
        
    
//set player Z velocity to make player bounce
    entity_get_vector(mid, EV_VEC_velocity, velocity)
    velocity[2] = 250.0                    //jump velocity
    entity_set_vector(mid, EV_VEC_velocity, velocity)
        
    entity_set_int
(mid, EV_INT_gaitsequence, 6)        //play the Jump Animation

    new h = random(3)

    emit_sound(mid, CHAN_WEAPON, soundHiccups[h], 1.0, ATTN_NORM, 0, PITCH_NORM)

    new r = random(5) + 1
    set_task
(float(r), "PlayHic", id)
    
    return 1
}

public UnHiccupUser(id)
{
    new pName[32]

    is_hiccup[(id - TASK_HICCUP) - 1] = false

    get_user_name
(id - TASK_HICCUP, pName, 31)
    client_print(0, print_chat, "[AMXX TRAPS] %s no longer has the hiccups!", pName)

        if (task_exists(id))
                remove_task(id)

    if(task_exists(id + 100))
        remove_task(id + 100)
}

public cmdMath(id) {
    new count = random_num(3, 6)
    new values[10]
    new operations[10]
    
    for
(new i = 0; i < count; i++) {

        if(< count - 1)
            operations[i] = random_num(0, 3)

        do {
            values[i] = random_num(1, 20)
        } while ((> 0) && (values[i] == 0) && (operations[- 1] == OP_DIVIDE))

    }
    
    new solved 
= values[random_num(0, count - 1)]
    
    new str
[256]
    new fl[16]
    
    for
(new i = 0; i < count - 1; i++) {
        add(str, sizeof(str), "(")
    }
    for(new i = 0; i < count; i++) {
        if(values[i] == solved) {
            add(str, sizeof(str), "x");
        } else {
            num_to_str(values[i], fl, sizeof(fl))
            add(str, sizeof(str), fl)
        }
        if(> 0) {
            add(str, sizeof(str), ")")
        }
        
        if
(< count - 1) {
            add(str, sizeof(str), operators[operations[i]])
        }
        
    
}
    
    new Float
:fValue = float(values[0])
    for(new i = 1; i < count; i++) {
        switch(operations[- 1]) {
            case OP_ADD: fValue = floatadd(fValue, float(values[i]))
            case OP_SUBTRACT: fValue = floatsub(fValue, float(values[i]))
            case OP_MULTIPLY: fValue = floatmul(fValue, float(values[i]))
            case OP_DIVIDE: fValue = floatdiv(fValue, float(values[i]))
        }

    }
    
    if 
(solved == mathLastGuess[id - 1])
    {
        cmdMath(id)
        return PLUGIN_HANDLED
    
}
    if (solved == mathLastGuess2[id - 1])
    {
        cmdMath(id)
        return PLUGIN_HANDLED
    
}

    format(mathEquations[id - 1], 127, "Problem: %s = %f", str, fValue)

    mathAnswer[id - 1] = solved

    set_hudmessage
(200, 155, 0, -1.0, 0.50, 0, 6.0, 1.0, 0.3, 0.5, 3)
    show_hudmessage(id, mathEquations[id - 1])

    set_task(1.0, "MathTask", TASK_MATH + id, "", 0, "b")

    return PLUGIN_HANDLED
}

public MathTask(id)
{
    new mid = id - TASK_MATH

    if 
(is_math[mid - 1])
    {
        set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 1.1, 0.3, 0.5, 3)
        show_hudmessage(mid, mathEquations[mid - 1])
    }


}
/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  MENU SETUPS     \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// Sets up the Buy Menu (for picking which Trap to buy)
//

public SetupBuyMenu()
{
    new menuLen = format(BuyMenuBodyText, 255, "\rBuy Traps^n^n")
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w1. Bury Trap \y($%d)^n", get_cvar_num("traps_price_bury"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w2. Slap Trap \y($%d)^n", get_cvar_num("traps_price_slap"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w3. Death Trap \y($%d)^n", get_cvar_num("traps_price_death"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w4. Blind Trap \y($%d)^n", get_cvar_num("traps_price_blind"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w5. Slow Trap \y($%d)^n", get_cvar_num("traps_price_slow"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w6. Math Trap \y($%d)^n", get_cvar_num("traps_price_math"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w7. Drug Trap \y($%d)^n", get_cvar_num("traps_price_drug"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w8. Hiccup Trap \y($%d)\w^n^n9. Back^n0. Exit", get_cvar_num("traps_price_hiccup"))

    return 1
}

//
// Sets up the main menu
//

public SetupMainMenu()
{
    new menuLen = format(MainMenuBodyText, 255, "\rTraps!^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w1. Buy Trap^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w2. Pick Trap^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w4. Set Trap^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w6. Buy Trap Goggles \y($%d)^n^n^n^n", get_cvar_num("traps_price_goggle"))

    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w0. Exit")

    return 1
}

//
// Sets up the Pick Menu (for picking which Trap to plant)
//
public SetupPickMenu(id)
{
    new menuLen = format(PickMenuBodyText, 255, "\rPick the trap to plant^n^n")
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w1. Bury Trap \y(%d)^n", pTrapTypes[id - 1][T_BURY])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w2. Slap Trap \y(%d)^n", pTrapTypes[id - 1][T_SLAP])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w3. Death Trap \y(%d)^n", pTrapTypes[id - 1][T_DEATH])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w4. Blind Trap \y(%d)^n", pTrapTypes[id - 1][T_BLIND])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w5. Slow Trap \y(%d)^n", pTrapTypes[id - 1][T_SLOW])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w6. Math Trap \y(%d)^n", pTrapTypes[id - 1][T_MATH])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w7. Drug Trap \y(%d)^n", pTrapTypes[id - 1][T_DRUG])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w8. Hiccup Trap \y(%d)\w^n^n9. Back^n0. Exit", pTrapTypes[id - 1][T_HICCUP])

    return 1
}


/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  HELP    \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

public ClCmdSay(id)
{
    new Message[128], pName[32]

    read_argv(1, Message, 127)
    remove_quotes(Message)

    if (containi(Message, "//trap:") != -1)
    {
        new lft[32] = ""
        new rht[32] = ""
        strtok(Message, lft, 31, rht, 31, ':')
        
        new player 
= cmd_target(id, rht, 2);

        if (!player)
            return PLUGIN_HANDLED;

        client_print(id, print_console, "Bury: %d", is_bury[player - 1] ? 1 : 0)
        client_print(id, print_console, "Blind: %d", is_blind[player - 1] ? 1 : 0)
        client_print(id, print_console, "Slow: %d", is_slow[player - 1] ? 1 : 0)
        client_print(id, print_console, "Math: %d", is_math[player - 1] ? 1 : 0)
        client_print(id, print_console, "Drug: %d", is_drugged[player - 1] ? 1 : 0)
        client_print(id, print_console, "Hiccup: %d", is_hiccup[player - 1] ? 1 : 0)

        return PLUGIN_HANDLED
    
}

    new myAns[128], pOrigin[3]
    num_to_str(mathAnswer[id - 1], myAns, 127)

    if (is_math[id - 1] && is_str_num(Message))
    {
        if (!equali(Message, mathLastGuess[id - 1]))
        {
            if (!equali(Message, mathLastGuess2[id - 1]))
            {
                mathLastGuess2[id - 1] = mathLastGuess[id - 1]
                mathLastGuess[id - 1] = str_to_num(Message)
            }
        }
                
            

        if 
(equali(Message, myAns))
        {
            client_print(id, print_chat, "[AMXX TRAPS] Correct Answer!!!")

            user_speed[id - 1] = 250.0
            set_user_maxspeed
(id, 250.0)
            get_user_origin(id, pOrigin, 0)
            pOrigin[2] += 30;
            set_user_origin(id, pOrigin)
            is_math[id - 1] = false

                if 
(task_exists(id + TASK_MATH))
                        remove_task(id + TASK_MATH)

            get_user_name(id, pName, 31)

            client_print(0, print_chat, "[AMXX TRAPS] %s solved his equation and is no longer stuck!", pName)
            set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
            mathLastGuess[id - 1] = -1
        
}
        else
        
{
            new Health = get_user_health(id)
            new hp

            if 
(Health <= 10)
            {
                if (Health == 1)
                {
                    user_kill(id)
                    client_print(id, print_chat, "[AMXX TRAPS] WRONG!!!!! You were killed!! hahahahaa!!")
                    return PLUGIN_HANDLED
                
} else {
                    hp = 1
                
}
            } else {
                hp = Health - 10
            
}
            
            set_user_health
(id, hp)

            client_print(id, print_chat, "[AMXX TRAPS] WRONG!!!!! You lose %d health!", Health - hp)
            cmdMath(id)
        }

        return PLUGIN_HANDLED
    
}

    if ((containi(Message, "trap") != -1) && (containi(Message, "how") != -1))
    {
        client_print(id, print_chat, "[AMXX TRAPS] type /traps to bring up the traps menu")
    }

    return PLUGIN_CONTINUE




Фрагмент кода который меняю, меню открывается но после того как нажимаю цифру оно закрывается.
Код: Выделить всё
//
// Sets up the Buy Menu (for picking which Trap to buy)
//

public SetupBuyMenu()
{
    new menuLen = format(BuyMenuBodyText, 255, "\rКупить ловушки^n^n")
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w1. Похоронная \y($%d)^n", get_cvar_num("traps_price_bury"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w2. Дать леща \y($%d)^n", get_cvar_num("traps_price_slap"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w3. Смертельная \y($%d)^n", get_cvar_num("traps_price_death"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w4. Ослепить \y($%d)^n", get_cvar_num("traps_price_blind"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w5. Скорость улитки \y($%d)^n", get_cvar_num("traps_price_slow"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w6. Математическая \y($%d)^n", get_cvar_num("traps_price_math"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w7. Накурить игрока \y($%d)^n", get_cvar_num("traps_price_drug"))
    menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w8. Ловушка Икоты \y($%d)\w^n^n9. Назад^n0. Выход", get_cvar_num("traps_price_hiccup"))

    return 1
}

//
// Sets up the main menu
//

public SetupMainMenu()
{
    new menuLen = format(MainMenuBodyText, 255, "\rЛовушки!^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w1. Купить ловушку^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w2. Выбрать ловушку^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w4. Установить Ловушку^n^n")
    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w6. Очки для ловушек \y($%d)^n^n^n^n", get_cvar_num("traps_price_goggle"))

    menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w0. Выход")

    return 1
}

//
// Sets up the Pick Menu (for picking which Trap to plant)
//
public SetupPickMenu(id)
{
    new menuLen = format(PickMenuBodyText, 255, "\rВыберите ловушку^n^n")
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w1. Похоронная \y(%d)^n", pTrapTypes[id - 1][T_BURY])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w2. Дать леща \y(%d)^n", pTrapTypes[id - 1][T_SLAP])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w3. Смертельная \y(%d)^n", pTrapTypes[id - 1][T_DEATH])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w4. Ослепить \y(%d)^n", pTrapTypes[id - 1][T_BLIND])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w5. Скорость улитки \y(%d)^n", pTrapTypes[id - 1][T_SLOW])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w6. Математическая \y(%d)^n", pTrapTypes[id - 1][T_MATH])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w7. Накурить игрока \y(%d)^n", pTrapTypes[id - 1][T_DRUG])
    menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w8. Ловушка Икоты \y(%d)\w^n^n9. Назад^n0. Выход", pTrapTypes[id - 1][T_HICCUP])

    return 1
}
 




До перевода плаин работает, можете подсказать причину того что плагин работает не корректно?
Сохраню в UTF без BOM
Аватара пользователя
pro100-bad
 
Сообщения: 30
Зарегистрирован: 06 янв 2018, 17:07
Благодарил (а): 1 раз.
Поблагодарили: 0 раз.
Опыт программирования: Меньше недели
Языки программирования: C++
Php
CSS
HTML

Re: Не работает плагин после перевода на русский

Сообщение MayroN » 22 май 2018, 21:08

То,что Вы делаете - маловато.Нужно зарегистрировать Ваши Русские названия здесь
Код: Выделить всё
    SetupBuyMenu()
        SetupMainMenu()

    register_menucmd(register_menuid("\rTraps!//<===На Русском"), MainMenuKeys, "Traps")
    register_menucmd(register_menuid("\rPick the trap to plant//<===На Русском"), MenuKeys, "PickIt")
    register_menucmd(register_menuid("\rBuy Traps//<===На Русском"), MenuKeys, "BuyIt")


Точно с таким-же названием,как Вы написали ранее.

Из-за етого и несостиковка.
МультиМод CS
Аватара пользователя
MayroN
 
Сообщения: 673
Зарегистрирован: 10 окт 2010, 18:23
Откуда: Украина, г. Белая Церковь
Благодарил (а): 149 раз.
Поблагодарили: 86 раз.
Опыт программирования: Около года
Языки программирования: На которых говорю...


Вернуться в Скриптинг

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 15