Results 1 to 5 of 5

Thread: Pomoc oko plugina

  1. #1
    Vodnik
    Join Date
    Jan 2017
    Age
    22
    Posts
    6
    Karma
    4

    Question Pomoc oko plugina

    Imam problem sto se tice nekog shop plugina,nasao sam na AlliedModders neki source kod i kada sam ga compile ne radi komanda /shop
    Ako moze neko da pomogne
    Kada se compiluje plugin ne izlazi nikakav error
    link: https://forums.alliedmods.net/showthread.php?t=225391


    Code:
    /* Plugin generated by AMXX-Studio */
    
    #include <amxmodx>
    #include <amxmisc>
    #include <cstrike>
    #include <hamsandwich>
    #include <fun>
    
    #define PLUGIN "OOE Shop"
    #define VERSION "1.1.0"
    #define AUTHOR "Kia"
    
    // ===============================================================================
    //     Variables 
    // ===============================================================================
    
    /* Booleans */
    
    new bool:g_bHasGrenade[33]
    new bool:g_bHasFlashbang[33]
    new bool:g_bHasFrostNade[33]
    new bool:g_bHasHealth[33]
    new bool:g_bHasAWP[33]
    new bool:g_bHasRespawn[33]
    
    new bool:g_bHasSilentFeet[33]
    new bool:g_bHasNoFlash[33]
    new bool:g_bHasNoFrost[33]
    
    
    /* Misc */
    
    new g_msgScreenFade
    
    
    // ===============================================================================
    //     plugin_init
    // ===============================================================================
    
    public plugin_init() 
    {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        
        /* Events */
        
        register_event("ScreenFade", "Event_Flashed", "be", "4=255", "5=255", "6=255", "7>199")
        
        /* Logevents */
        
        register_logevent("LogEvent_RoundEnd", 2, "1=Round_End")  
            
        /* Commands */
        
        register_clcmd("say /shop",         "cmd_Shop")
        register_clcmd("say_team /shop",     "cmd_Shop")
        register_clcmd("say shop",         "cmd_Shop")
        register_clcmd("say_team shop",     "cmd_Shop")
        register_clcmd("shop",            "cmd_Shop")
        
        /* Misc */
        
        g_msgScreenFade = get_user_msgid("ScreenFade")
    }
    
    // ===============================================================================
    //     Event_Flashed - Called when a player gets flashed
    // ===============================================================================
    
    public Event_Flashed(id)
    {
        if(g_bHasNoFlash[id])
        {
            message_begin(MSG_ONE, g_msgScreenFade, {0,0,0},id)
            write_short(1)
            write_short(1)
            write_short(1)
            write_byte(0)
            write_byte(0)
            write_byte(0)
            write_byte(255)
            message_end()
        }
    }
    
    // ===============================================================================
    //     LogEvent_RoundEnd - Called when a Round ends
    // ===============================================================================
    
    public LogEvent_RoundEnd()
    {
         arrayset(g_bHasGrenade, 0, sizeof(g_bHasNoFlash))
         arrayset(g_bHasFlashbang, 0, sizeof(g_bHasFlashbang))
         arrayset(g_bHasFrostNade, 0, sizeof(g_bHasFrostNade))
         arrayset(g_bHasHealth, 0, sizeof(g_bHasHealth))
         arrayset(g_bHasAWP, 0, sizeof(g_bHasAWP))
         arrayset(g_bHasRespawn, 0, sizeof(g_bHasRespawn))
         arrayset(g_bHasSilentFeet, 0, sizeof(g_bHasSilentFeet))
         arrayset(g_bHasNoFlash, 0, sizeof(g_bHasNoFlash))
         arrayset(g_bHasNoFrost, 0, sizeof(g_bHasNoFrost))
    }
    
    // ===============================================================================
    //     cmd_Shop - Called when someone is typing (say(_team)) (/)shop
    // ===============================================================================
    
    public cmd_Shop(id)
    {
        switch(cs_get_user_team(id))
        {
            case CS_TEAM_T : func_OpenTShop(id)
            case CS_TEAM_CT : func_OpenCTShop(id)
        }
    }
    
    // ===============================================================================
    //     func_OpenTShop - Opened when a Terrorist opens the Shop
    // ===============================================================================
    
    public func_OpenTShop(id)
    {    
        new szMenuTitle[64]
        formatex(szMenuTitle, charsmax(szMenuTitle), "OOE Shop - Terror Shop")
        
        new menu = menu_create(szMenuTitle, "func_OpenTShop_handler")
        
        menu_additem(menu, "HE Grenade",     "1",         g_bHasGrenade[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "Flashbang",     "2",         g_bHasFlashbang[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "FrostNade",     "3",         g_bHasFrostNade[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "155 Extra Health",     "4",         g_bHasHealth[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "AWP (1 Bullet)",    "5",         g_bHasAWP[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "Respawn",         "6",         is_user_alive(id) || g_bHasRespawn[id] ? 1<<31 : 0)
        
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display( id, menu, 0 )
        return PLUGIN_HANDLED
    }
    
    public func_OpenTShop_handler(id, menu, item)
    {
        new money = cs_get_user_money(id)
    
        switch(item)
        {
            case 1: 
            {
                if(money >= 1500)
                {
                    Reduce(id, 1500)
                    func_giveitem_he(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 2: 
            {
                if(money >= 1000)
                {
                    Reduce(id, 1000)
                    func_giveitem_flash(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 3: 
            {
                if(money >= 2500)
                {
                    Reduce(id, 2500)
                    func_giveitem_frost(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 4: 
            {
                if(money >= 5500)
                {
                    Reduce(id, 5500)
                    func_giveitem_health(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 5: 
            {
                if(money >= 6500)
                {
                    Reduce(id, 6500)
                    func_giveitem_awp(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 6: 
            {
                if(money >= 12000)
                {
                    Reduce(id, 12000)
                    func_giveitem_respawn(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
        }
    }
    
    // ===============================================================================
    //     func_OpenTShop - Opened when a CT opens the Shop
    // ===============================================================================
    
    public func_OpenCTShop(id)
    {    
        new szMenuTitle[64]
        formatex(szMenuTitle, charsmax(szMenuTitle), "OOE Shop - CT Shop")
        
        new menu = menu_create(szMenuTitle, "func_OpenCTShop_handler")
        
        menu_additem(menu, "HE Grenade",     "1",         g_bHasGrenade[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "155 Extra Health",     "2",         g_bHasHealth[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "Silent Feet",     "3",         g_bHasSilentFeet[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "Respawn",         "4",         is_user_alive(id) || g_bHasRespawn[id] ? 1<<31 : 0)
        menu_additem(menu, "Anti-Flash",    "5",         g_bHasNoFlash[id] || !is_user_alive(id) ? 1<<31 : 0)
        menu_additem(menu, "Anti-Frost",     "6",         g_bHasNoFrost[id] || !is_user_alive(id) ? 1<<31 : 0)
        
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display( id, menu, 0 )
        return PLUGIN_HANDLED
    }
    
    public func_OpenCTShop_handler(id, menu, item)
    {
        new money = cs_get_user_money(id)
        
        switch(item)
        {
            case 1: 
            {
                if(money >= 1500)
                {
                    Reduce(id, 1500)
                    func_giveitem_he(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 2: 
            {
                if(money >= 5500)
                {
                    Reduce(id, 5500)
                    func_giveitem_health(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 3: 
            {
                if(money >= 7500)
                {
                    Reduce(id, 7500)
                    func_giveitem_sf(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 4: 
            {
                if(money >= 12000)
                {
                    Reduce(id, 12000)
                    func_giveitem_respawn(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 5: 
            {
                if(money >= 9000)
                {
                    Reduce(id, 9000)
                    func_giveitem_aflash(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
            case 6: 
            {
                if(money >= 12500)
                {
                    Reduce(id, 12500)
                    func_giveitem_afrost(id)
                }
                else
                    client_print(id, print_chat, "You don't have enough money to buy this.")
            }
        }
    }
    
    
    
    // ===============================================================================
    //     Item Handlers
    // ===============================================================================
    
    public func_giveitem_he(id)
    {
        give_item(id, "weapon_hegrenade")
        g_bHasGrenade[id] = true
    }
    
    public func_giveitem_flash(id)
    {
        give_item(id, "weapon_flashbang")
        g_bHasFlashbang[id] = true
    }
    
    public func_giveitem_frost(id)
    {
        give_item(id, "weapon_smokegrenade")
        g_bHasFrostNade[id] = true
    }
        
    public func_giveitem_health(id)
    {
        set_user_health(id, get_user_health(id) + 155)
        g_bHasHealth[id] = true
    }
        
    public func_giveitem_awp(id)
    {
        new iWeapon = give_item(id, "weapon_awp")
        if( iWeapon > 0 ) 
        { 
            cs_set_user_bpammo(id, CSW_AWP, 0)
            cs_set_weapon_ammo(iWeapon, 0)
        }
        
        new szName[33]
        get_user_name(id, szName, charsmax(szName))
        
        client_print(0, print_chat, "%s bought an AWP with one bullet!", szName)
        
        g_bHasAWP[id] = true
    }
    
    public func_giveitem_respawn(id)
    {
        ExecuteHamB(Ham_CS_RoundRespawn, id)
        
        new szName[33]
        get_user_name(id, szName, charsmax(szName))
        
        client_print(0, print_chat, "%s bought Respawn!", szName)
        
        g_bHasRespawn[id] = true
    }
        
    public func_giveitem_sf(id)
    {
        set_user_footsteps(id, 1)
        g_bHasSilentFeet[id] = true
    }
    
    public func_giveitem_aflash(id)
        g_bHasNoFlash[id] = true
        
    public func_giveitem_afrost(id)
        g_bHasNoFrost[id] = true
        
    // ===============================================================================
    //     FrostNades
    // ===============================================================================
    
    public frostnades_player_chilled( victim, attacker )
    {
        if(g_bHasNoFrost[victim])
            return PLUGIN_HANDLED
        return PLUGIN_CONTINUE
    }
    
    public frostnades_player_frozen( victim, attacker )
    {
        if(g_bHasNoFrost[victim])
            return PLUGIN_HANDLED
        return PLUGIN_CONTINUE
    }
    
    // ===============================================================================
    //     Stocks
    // ===============================================================================
    
    stock Reduce(id, amount)
        cs_set_user_money(id, cs_get_user_money(id) - amount)
    edit: Ja sam editovao plugin vise od 50% sve zivo promenio ali nisam razmisljao o tome da /shop meni nece da otvori pa sam mislio da sam nest pogresio dok sam editovao i opet uzo default source i probao ali ne radi.Plugin nisam ubacivao na server nego u svoj cs,Da li je mozda problem sto sam ubacio u svoj cs a ne na srv?
    Last edited by bull3t; 19.02.17 at 13:20.

  2. #2
    CyberShark developer
    Join Date
    Nov 2011
    Location
    Tokyo, Japan
    Posts
    918
    Karma
    38

    Re: Pomoc oko plugina

    Logicno je da nece raditi jer mora da bude ubaceno na server.



  3. #3
    Vodnik
    Join Date
    Jan 2017
    Age
    22
    Posts
    6
    Karma
    4

    Re: Pomoc oko plugina

    Quote Originally Posted by Megastorm View Post
    Logicno je da nece raditi jer mora da bude ubaceno na server.
    Da li moze plugin da radi kad ga ubacim u moj cs?
    - Ako moze,kako?

  4. #4
    CyberShark developer
    Join Date
    Nov 2011
    Location
    Tokyo, Japan
    Posts
    918
    Karma
    38

    Re: Pomoc oko plugina

    Quote Originally Posted by bull3t View Post
    Da li moze plugin da radi kad ga ubacim u moj cs?
    - Ako moze,kako?
    Moze, ali nece ti raditi kad igras na nekom serveru.
    Radice samo u lokali, odnosno kad pokrenes igru preko "New game".



  5. #5
    Vodnik
    Join Date
    Jan 2017
    Age
    22
    Posts
    6
    Karma
    4

    Re: Pomoc oko plugina

    Quote Originally Posted by Megastorm View Post
    Moze, ali nece ti raditi kad igras na nekom serveru.
    Radice samo u lokali, odnosno kad pokrenes igru preko "New game".
    To sam i radio nekad hoce da radi nekad nece
    U svakom slucaju hvala na pomoci,bitno mi je da plugin nije sj***n
    Moze lock

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •