AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   CSDM (https://forums.alliedmods.net/forumdisplay.php?f=87)
-   -   Help ! CSDM Shop ! (https://forums.alliedmods.net/showthread.php?t=245728)

chalcer 08-06-2014 03:39

Help ! CSDM Shop !
 
hello guys
first of all dont laugh lol bcz im noob still learning
well
here's the shop of dm
https://forums.alliedmods.net/showth...17064?t=217064
So I want to know how to remove/add something from this shop
thanks in advance
regards!.

EpicKiller 08-06-2014 07:33

Re: Help ! CSDM Shop !
 
The URL you provided is wrong. Adding or removing stuff from a menu is pretty general, but still, please provide the source, so the explanation you are about to get can be much more accurate, including practical examples, on the specific plugin.

chalcer 08-06-2014 07:42

Re: Help ! CSDM Shop !
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>


#define PLUGIN "Shop"
#define VERSION "1.1"
#define AUTHOR "Darksmith"

#pragma semicolon 1

new g_iMenu, gmsgBlinkAcct, g_iMaxPlayers;

enum _:playerTasks ( += 33 )
{
    TASK_PLAYER_REMOVE_GODMODE,
    TASK_PLAYER_REMOVE_INVIS,
    TASK_PLAYER_REMOVE_NOCLIP
}

enum Datas
{
    m_szName[32],
    m_iCost
}

new const g_mItems[][Datas] =
{
    {"No Clip        \r30 Seconds", 4000},
    {"Godmode        \r20 Seconds", 3500},
    {"Invisibility    \r40 Seconds", 6000},
    {"500 Health and Armor  \r1 Round", 5000},
    {"Speed and Gravity    \r1 Round", 3000}
};

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);

    register_clcmd("say /lm", "shop");
    register_clcmd("say /shop", "shop");
    register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0");
       
   
    CreateMenu();

    gmsgBlinkAcct = get_user_msgid("BlinkAcct");
}

public Event_HLTV_New_Round()
{
    for(new id = 1; id<=g_iMaxPlayers; id++)
    {
        remove_task( id + TASK_PLAYER_REMOVE_GODMODE );
        remove_task( id + TASK_PLAYER_REMOVE_INVIS );
        remove_task( id + TASK_PLAYER_REMOVE_NOCLIP );
        Task_Remove_Noclip( id );
        Task_Remove_GodMode( id );
        Task_Remove_Invis( id );
    }
}

CreateMenu()
{
    g_iMenu = menu_create( "\wShop Menu \R\y$", "ShopMenuHandler" );

    new szItem[64];
    for(new i; i<sizeof(g_mItems); i++)
    {
        formatex(szItem, charsmax(szItem), "%s\R\y%d", g_mItems[i][m_szName], g_mItems[i][m_iCost]);
        menu_additem(g_iMenu, szItem);
    }
}
public shop(id)
{
    if(is_user_alive(id))
    {
        menu_display(id, g_iMenu);
    }
}

public ShopMenuHandler(id, menu, item )
{
    if(item >=0 && is_user_alive(id))
    {
        new newMoney = cs_get_user_money(id) - g_mItems[item][m_iCost];
        if( newMoney <= 0 )
        {
            client_print(id, print_chat, "Sorry ,You Don't have Enught Money");
           
            message_begin(MSG_ONE, gmsgBlinkAcct, _, id);
            {
                write_byte(2);
            }
            message_end();
            return;
        }
        cs_set_user_money(id, newMoney);

        switch(item)
        {
            case 0:
            {
                set_user_noclip(id, 1);
                set_task(30.0, "Task_Remove_Noclip", id + TASK_PLAYER_REMOVE_NOCLIP);
                client_print(id, print_chat, "You Have Bought No Clip for 30 Seconds");
            }
            case 1:
            {
                set_user_godmode(id, 1);
                set_task(20.0, "Task_Remove_GodMode", id + TASK_PLAYER_REMOVE_GODMODE);
                client_print(id, print_chat, "You Have Bought Godmode for 20 Seconds");
            }
            case 2:
            {
                set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha);
                set_task(40.0, "Task_Remove_Invis", id + TASK_PLAYER_REMOVE_INVIS);
                client_print(id, print_chat, "You Have Bought Invisibilty for 40 Seconds");
            }
            case 3:
            {
                set_user_health(id, 500);
                cs_set_user_armor(id, 500, CS_ARMOR_VESTHELM);
                client_print(id, print_chat, "You Have Buy 500 Armor + Health");
            }
            case 4:
            {
                set_user_maxspeed(id, 500.0);
                set_user_gravity(id, 0.2);
                client_print(id, print_chat, "You Have Buy Speed and Gravity");
            }
        }
    }
}

public Task_Remove_Noclip( id )
{
    id %= 33;
    if( is_user_connected(id) )
    {
        set_user_noclip(id, 0);
    }
}

public Task_Remove_GodMode( id )
{
    id %= 33;
    if( is_user_connected(id) )
    {
        set_user_godmode(id, 0);
    }
}

public Task_Remove_Invis( id )
{
    id %= 33;
    if( is_user_connected(id) )
    {
        set_user_rendering(id, _, 0, 0, 0, _, 0);
    }
}



/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/


EpicKiller 08-06-2014 08:39

Re: Help ! CSDM Shop !
 
You would have to go to the "const g_mItems". There, you would modify the options that will appear in the menu and their price. Then, you would go to the menu handler, which is here "ShopMenuHandler". The only part that you need to modify is the "switch" function. It is zero-based, so the first option in the menu would be "case 0:", the second option would be "case 1:" and so on.

I hope I helped. :)

EDIT: If you are going to remove the noclip, invis or godmode, also remove their "remove_task"s from the "Event_HLTV_New_Round".

chalcer 08-06-2014 11:20

Re: Help ! CSDM Shop !
 
Quote:

Originally Posted by EpicKiller (Post 2179781)
You would have to go to the "const g_mItems". There, you would modify the options that will appear in the menu and their price. Then, you would go to the menu handler, which is here "ShopMenuHandler". The only part that you need to modify is the "switch" function. It is zero-based, so the first option in the menu would be "case 0:", the second option would be "case 1:" and so on.

I hope I helped. :)

EDIT: If you are going to remove the noclip, invis or godmode, also remove their "remove_task"s from the "Event_HLTV_New_Round".

Yeah You Helped Me A LoT Big Thnx To You
Just If you Can Give A Example Of Removing No -Clip For Example
Thanx In Advance ! :)

EpicKiller 08-06-2014 15:15

Re: Help ! CSDM Shop !
 
1 Attachment(s)
Sure. Here you go. This is the plugin with the noclip removed.

chalcer 08-06-2014 15:59

Re: Help ! CSDM Shop !
 
Big Thnx to You Brohter
Keep Going Good Luck With Learnin Pawn :)


All times are GMT -4. The time now is 15:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.