Raised This Month: $ Target: $400
 0% 

what's wrong here?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
groofshark
Member
Join Date: Jul 2013
Old 05-19-2015 , 19:46   what's wrong here?
Reply With Quote #1

PHP Code:
#define PLUGIN "Pro Shop"
#define VERSION "0.0.1"
#define AUTHOR "groofshark"

#include <amxmodx>
#include <hamsandwich>

#define MAX_PLAYERS 32
#define MAX_ITEMS    2

enum ( <<=)
{
    
ExtraHP 1
    
ExtraArmor,
    
SilentFootsteps
}
new 
g_pItems[MAX_PLAYERS 1]
#define ActivatePlayerItem(%1, %2)    ( g_pItems[%1] |= %2 )
#define DeactivatePlayerItem(%1, %2)    ( g_pItems[%1] &= ~%2 )
new g_pItemsCounter[MAX_PLAYERS 1]
#define ResetPlayerItemCounter(%1)    ( g_pItemsCounter[%1] = 0 )

enum _:UniqueMenuOptions
{
    
_Items,
    
_ItemsStatus
}
new 
g_bUnique[MAX_PLAYERS 1][UniqueMenuOptions]
#define UniqueMenuOptions(%1, %2)    ( %1 & (1<<%2) )
#define ActivateUMO(%1, %2)    ( %1 |= (1<<%2) )
#define DeactivateUMO(%1, %2)    ( %1 &= ~(1<<%2) )

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR )
    
    
RegisterHam(Ham_Spawn"player""CBase_Player_Spawn_P"true)
    
    
register_clcmd("say /shop""ClCmd_Shop")
        
register_clcmd("say_team /shop""ClCmd_Shop")
}

public 
CBase_Player_Spawn_P(id)
{
    if( 
is_user_alive(id) )
    {
        
ResetPlayerItemCounter(id)

        
ActivatePlayerItem(idExtraHP)
        
ActivatePlayerItem(idExtraArmor)
        
ActivatePlayerItem(idSilentFootsteps)

        switch( 
UniqueMenuOptions(id_Items) )
        {
            case 
1..3DeactivateUMO(id_ItemsStatus)
        }
    }
}    

public 
ClCmd_Shop(id)
{
        new 
szTemp[500 char]
        
formatex(szTempcharsmax(szTemp), "\r[Shop] \yItems Menu")
         
        new 
iMenu menu_create(szTemp"Items_Menu_Handler")
        new 
iCallback menu_makecallback("Items_Menu_Callback")
        
        
formatex(szTempcharsmax(szTemp), "Extra HP")
        
menu_additem(iMenuszTemp"1")
        
        
formatex(szTempcharsmax(szTemp), "Extra AP")
        
menu_additem(iMenuszTemp"2")
    
        
formatex(szTempcharsmax(szTemp), "Silent Footsteps")
        
menu_additem(iMenuszTemp"3")
        
        
menu_display(idiMenu)
}

public 
Items_Menu_Handler(idiMenuiItem
{    
        if( 
iItem == MENU_EXIT 
        {
            
menu_destroy(iMenu)
            return 
PLUGIN_HANDLED
        
}
        
      switch(
iItem
        {
        case 
0// Option #1 from menu
        
{
            
ActivatePlayerItem(idExtraHP)
            if( 
g_Items[id] & ExtraHP )
            {
                
set_user_health(idget_user_health(iPlayer) + 50)
            }
        }
         case 
1// Option #2 from menu
        
{
            
ActivatePlayerItem(idExtraAP)
            if( 
g_Items[id] & ExtraArmor )
            {
                
set_user_armor(id100)
            }
        }
        case 
2// Option #3 from menu
        
{    
            
ActivatePlayerItem(idSilentFootsteps)
            if( 
g_Items[id] & SilentFootsteps )
            {
                
set_user_footsteps(id1)
            }
            
            }
        }    
    }
    
    return 
PLUGIN_HANDLED

groofshark is offline
 



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:04.


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