AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   what's wrong here? (https://forums.alliedmods.net/showthread.php?t=263155)

groofshark 05-19-2015 19:46

what's wrong here?
 
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



fysiks 05-19-2015 19:49

Re: what's wrong here?
 
You have to tell us what is wrong before anybody can help you.

tousif 05-20-2015 05:27

Re: what's wrong here?
 
Post the error's plzz

groofshark 05-20-2015 09:12

Re: what's wrong here?
 
Just it can't compile...

undefined symbol ActivatePlayerItem and 1-2 other mistakes, try it

fysiks 05-20-2015 18:59

Re: what's wrong here?
 
Simply look for the lines that is shows in the compile errors. Read the error and it generally tells you exactly what is wrong. In the case of the one you posted, that variable is not defined you either need to define it or determine if it's spelled wrong.


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

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