Raised This Month: $32 Target: $400
 8% 

Solved Add items


Post New Thread Reply   
 
Thread Tools Display Modes
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-03-2020 , 08:52   Re: Add items
Reply With Quote #11

Quote:
Originally Posted by AlexandruODT View Post
it doesn't work ... all the items appear but when you buy nothing happens ..maybe it's from cvars

the problem that not all the items in the menu appeared was from here

PHP Code:
for( new 08i++ )
    { 
i changed the number

can you make this menu work with credits?

PHP 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_iMenugmsgBlinkAcctg_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(PLUGINVERSIONAUTHOR);

    
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 1id<=g_iMaxPlayersid++)
    {
        
remove_taskid TASK_PLAYER_REMOVE_GODMODE );
        
remove_taskid TASK_PLAYER_REMOVE_INVIS );
        
remove_taskid TASK_PLAYER_REMOVE_NOCLIP );
        
Task_Remove_Noclipid );
        
Task_Remove_GodModeid );
        
Task_Remove_Invisid );
    }
}

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

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

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

        switch(
item)
        {
            case 
0:
            {
                
set_user_noclip(id1);
                
set_task(30.0"Task_Remove_Noclip"id TASK_PLAYER_REMOVE_NOCLIP);
                
client_print(idprint_chat"You Have Bought No Clip for 30 Seconds");
            }
            case 
1:
            {
                
set_user_godmode(id1);
                
set_task(20.0"Task_Remove_GodMode"id TASK_PLAYER_REMOVE_GODMODE);
                
client_print(idprint_chat"You Have Bought Godmode for 20 Seconds");
            }
            case 
2:
            {
                
set_user_rendering(idkRenderFxNone000kRenderTransAlpha);
                
set_task(40.0"Task_Remove_Invis"id TASK_PLAYER_REMOVE_INVIS);
                
client_print(idprint_chat"You Have Bought Invisibilty for 40 Seconds");
            }
            case 
3:
            {
                
set_user_health(id500);
                
cs_set_user_armor(id500CS_ARMOR_VESTHELM);
                
client_print(idprint_chat"You Have Buy 500 Armor + Health");
            }
            case 
4:
            {
                
set_user_maxspeed(id500.0);
                
set_user_gravity(id0.2);
                
client_print(idprint_chat"You Have Buy Speed and Gravity");
            }
        }
    }
}

public 
Task_Remove_Noclipid )
{
    
id %= 33;
    if( 
is_user_connected(id) )
    {
        
set_user_noclip(id0);
    }
}

public 
Task_Remove_GodModeid )
{
    
id %= 33;
    if( 
is_user_connected(id) )
    {
        
set_user_godmode(id0);
    }
}

public 
Task_Remove_Invisid )
{
    
id %= 33;
    if( 
is_user_connected(id) )
    {
        
set_user_rendering(id_000_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 }
*/ 
If it didn't worked then i can't help you without testing the plugin so give your mod that i can test this credit system on it
Attached Files
File Type: sma Get Plugin or Get Source (CreditShop.sma - 110 views - 4.1 KB)
Supremache is offline
AlexandruODT
Member
Join Date: May 2020
Old 06-04-2020 , 02:37   Re: Add items
Reply With Quote #12

Thanks, it's ok now
AlexandruODT is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:27.


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