AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin VIP ! (https://forums.alliedmods.net/showthread.php?t=221697)

MasKerT 07-25-2013 07:17

Plugin VIP !
 
Hi,

1. I want to help with something simple. I want to put exit button in this menu:

PHP Code:

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

#pragma semicolon         1

#define ADMIN_VIP        ADMIN_LEVEL_H

static const PLUGIN[ ]         = "VIP Biohazard";
static const 
VERSION[ ]         = "1.0";

new 
g_bAntidot33 ];
new 
g_bGrenade33 ];
new 
g_bInfection33 ];
new 
g_bEthereal33 ];
new 
g_bGoldM4A133 ];
new 
g_bCameleon33 ];
new 
g_bM32Grenader 33 ];
new 
g_bCrossBow33 ];
new 
g_iUsed32 ];

new 
pCvarUsed;

public 
plugin_init( ) 
{
    
register_pluginPLUGINVERSION"Unhask" );
    
    
RegisterHamHam_Spawn"player""plugin_spawn"true );
    
RegisterHamHam_Killed"player""plugin_death" );
    
    
register_clcmd"say /vipmenu""cmdShowMenu" );
    
    
pCvarUsed         register_cvar"vip_used""3" );
    
}

public 
client_connectid )
{
    if ( !( 
get_user_flagsid ) & ADMIN_VIP ) )
        return 
1;
        
    
g_bAntidotid ] = false;
    
g_bGrenadeid ] = false;
    
g_bInfectionid ] = true;
    
g_bEtherealid ] = false;
    
g_bGoldM4A1id ] = false;
    
g_bCameleonid ] = false;
    
g_bM32Grenaderid ] = false;
    
g_bCrossBowid ] = false;

    return 
1;
}

public 
plugin_spawnid )
{
    if ( !( 
get_user_flagsid ) & ADMIN_VIP ) )
        return 
1;
    
    
g_bAntidotid ] = false;
    
g_bGrenadeid ] = true;
    
g_bInfectionid ] = false;
    
g_bEtherealid ] = true;
    
g_bGoldM4A1id ] = true;
    
g_bCameleonid ] = true;
    
g_bM32Grenaderid ] = true;
    
g_bCrossBowid ] = true;
    
    
g_iUsedid ] = 0;

    return 
1;
}

public 
event_infectvictimattacker )
{
    if ( !( 
get_user_flagsvictim ) & ADMIN_VIP ) )
        return 
1;
    
    
g_bAntidotvictim ] = true;
    
g_bGrenadevictim ] = false;
    
g_bInfectionvictim ] = false;
    
g_bEtherealvictim ] = false;
    
g_bGoldM4A1victim ] = false;
    
g_bCameleonvictim ] = false;
    
g_bM32Grenadervictim ] = false;
    
g_bCrossBowvictim ] = false;

    return 
1;
}

public 
plugin_deathvictimattacker )
{
    if ( !( 
get_user_flagsvictim ) & ADMIN_VIP ) )
        return 
1;
    
    
g_bAntidotvictim ] = false;
    
g_bGrenadevictim ] = false;
    
g_bInfectionvictim ] = true;
    
g_bEtherealvictim ] = false;
    
g_bGoldM4A1victim ] = false;
    
g_bCameleonvictim ] = false;
    
g_bM32Grenadervictim ] = false;
    
g_bCrossBowvictim ] = false;
    
    return 
1;
}

public 
cmdShowMenuid )
{
    if ( !( 
get_user_flagsid ) & ADMIN_VIP ) )
        return 
1;
    
    if ( 
g_iUsedid ] == get_pcvar_numpCvarUsed ) )
        return 
1;
    
    new 
szMenuName165 ];
    
    
formatexszMenuNamesizeof szMenuName ) - 1"VIP Menu^nUsed: \R\r%i"g_iUsedid ] );
    
    new 
szMenu menu_createszMenuName"iContent" );
        
    new 
iCallBack  =  menu_makecallback"CallBackMenu" );
    
    
menu_additemszMenu"Antidot""1"_iCallBack );
    
menu_additemszMenu"HE Grenade""2"_iCallBack );
    
menu_additemszMenu"Zombie Spawn""3"_iCallBack );
    
menu_additemszMenu"Ethereal""4"_iCallBack );
    
menu_additemszMenu"M4A1 Gold""5"_iCallBack );
    
menu_additemszMenu"Cameleon""6"_iCallBack );
    
menu_additemszMenu"M32 Grenader""7"_iCallBack );
    
menu_additemszMenu"Crossbow""8"_iCallBack );
    
    
menu_setpropszMenuMEXIT_ALL);

    
menu_setpropszMenuMPROP_PERPAGE);

    
menu_displayidszMenu);
    
    
g_iUsedid ] ++;
    
    return 
1;
}

public 
iContentidszMenuItem )
{
    if ( 
Item == MENU_EXIT )
    {
        
menu_destroyszMenu );
        return 
1;
    }
    
    new 
iData], szName32 ];
    new 
iAccessiCallback;
    
    
menu_item_getinfoszMenuItemiAccessiDatasizeof iData ) - 1szNamesizeof szName ) - 1iCallback );
    
    new 
iKeys str_to_numiData );
    
    switch ( 
iKeys )
    {
        case 
1:
        {
            
        }
        
        case 
2:
        {
        
        }
        
        case 
3:
        {
            
        }
        
        case 
4:
        {
            
            
        }
        
        case 
5:
        {
            
        }
        
        case 
6:
        {
            
        }
        case 
7:
        {
            
        }
        
        case 
8:
        {
            
        }
    
    }

    return 
1;
}

public 
CallBackMenuidszMenuItem )
{    
    new 
iData], szName32 ];
    new 
iAccessiCallback;
    
    
menu_item_getinfoszMenuItemiAccessiDatasizeof iData ) - 1szNamesizeof szName ) - 1iCallback );
    
    
//if ( iData[ 0 ] == 0 ) 
    
    
if( iData] == '1' )
    {
        if( 
g_bAntidotid ] )
            return 
ITEM_ENABLED;
    }
    else if( 
iData] == '2' )
    {
        if( 
g_bGrenadeid ] )
            return 
ITEM_ENABLED;
    }
    else if( 
iData] == '3' )
    {
        if( 
g_bInfectionid ] )
            return 
ITEM_ENABLED;
    }
    else if( 
iData] == '4' )
    {
        if( 
g_bEtherealid ] )
            return 
ITEM_ENABLED;
    }
    else if( 
iData] == '5' )
    {
        if( 
g_bGoldM4A1id ] )
            return 
ITEM_ENABLED;
    }
    
    else if( 
iData] == '6' )
    {
        if( 
g_bCameleonid ] )
            return 
ITEM_ENABLED;
    }
    
    else if( 
iData] == '7' )
    {
        if( 
g_bM32Grenaderid ] )
            return 
ITEM_ENABLED;
    }
    
    else if( 
iData] == '8' )
    {
        if( 
g_bCrossBowid ] )
            return 
ITEM_ENABLED;
    }
    
    return 
ITEM_DISABLED;
        


I made something, but don't work:

PHP Code:

 menu_setpropszMenuMEXIT_ALL);

menu_setpropszMenuMPROP_PERPAGE);

menu_displayidszMenu); 

2. I want to help me with a code for zombie spawn. I wanna put it in menu like an item.

I made something, but I'm in CTs Team.

PHP Code:

 ExecuteHamBHam_CS_RoundRespawnid );
            
 
infect_userid);
            
if ( 
cs_get_user_teamid ) != CS_TEAM_T )
{
    
cs_set_user_teamidCS_TEAM_T );



iBrazilian 07-25-2013 07:25

Re: Plugin VIP !
 
Hey there, try the following and let me know if it works, not tested as I don't have biohazard but should work.

Code:

    #4th post is the correct one.

MasKerT 07-25-2013 09:38

Re: Plugin VIP !
 
It didn't work.

http://i40.tinypic.com/4taoar.jpg

iBrazilian 07-25-2013 09:54

Re: Plugin VIP !
 
Sorry for taking so long, try it now..

Code:

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

#pragma semicolon 1
#define ADMIN_VIP    ADMIN_LEVEL_H

static const PLUGIN[ ]    = "VIP Biohazard";
static const VERSION[ ]    = "1.0";

new g_bAntidot[ 33 ],g_bGrenade[ 33 ],g_bInfection[ 33 ],g_bEthereal[ 33 ],g_bGoldM4A1[ 33 ],g_bCameleon[ 33 ],g_bM32Grenader [ 33 ],g_bCrossBow[ 33 ],g_iUsed[ 32 ];
new pCvarUsed;
public plugin_init( )
{
    register_plugin( PLUGIN, VERSION, "Unhask" );
    RegisterHam( Ham_Spawn, "player", "plugin_spawn", true );
    RegisterHam( Ham_Killed, "player", "plugin_death" );
    register_clcmd( "say /vipmenu", "cmdShowMenu" );
    pCvarUsed        = register_cvar( "vip_used", "3" );
}

public client_connect( id )
{
    if ( !( get_user_flags( id ) & ADMIN_VIP ) )
        return 1;
       
    g_bAntidot[ id ] = false;    g_bGrenade[ id ] = false;    g_bInfection[ id ] = true;    g_bEthereal[ id ] = false;    g_bGoldM4A1[ id ] = false;    g_bCameleon[ id ] = false;    g_bM32Grenader[ id ] = false;    g_bCrossBow[ id ] = false;
  return 1;
}

public plugin_spawn( id )
{
    if ( !( get_user_flags( id ) & ADMIN_VIP ) )
        return 1;
   
    g_bAntidot[ id ] = false;    g_bGrenade[ id ] = true;    g_bInfection[ id ] = false;    g_bEthereal[ id ] = true;    g_bGoldM4A1[ id ] = true;    g_bCameleon[ id ] = true;    g_bM32Grenader[ id ] = true;    g_bCrossBow[ id ] = true;    g_iUsed[ id ] = 0;
    return 1;
}

public event_infect( victim, attacker )
{
    if ( !( get_user_flags( victim ) & ADMIN_VIP ) )
        return 1;
   
    g_bAntidot[ victim ] = true;    g_bGrenade[ victim ] = false;    g_bInfection[ victim ] = false;    g_bEthereal[ victim ] = false;    g_bGoldM4A1[ victim ] = false;    g_bCameleon[ victim ] = false;    g_bM32Grenader[ victim ] = false;    g_bCrossBow[ victim ] = false;
    return 1;
}

public plugin_death( victim, attacker )
{
    if ( !( get_user_flags( victim ) & ADMIN_VIP ) )
        return 1;
   
    g_bAntidot[ victim ] = false;    g_bGrenade[ victim ] = false;    g_bInfection[ victim ] = true;    g_bEthereal[ victim ] = false;    g_bGoldM4A1[ victim ] = false;    g_bCameleon[ victim ] = false;    g_bM32Grenader[ victim ] = false;    g_bCrossBow[ victim ] = false;
    return 1;
}

public cmdShowMenu( id )
{
    if ( !( get_user_flags( id ) & ADMIN_VIP ) )
        return 1;
   
    if ( g_iUsed[ id ] == get_pcvar_num( pCvarUsed ) )
        return 1;
   
    new szMenuName[ 165 ];
   
    formatex( szMenuName, sizeof ( szMenuName ) - 1, "VIP Menu^nUsed: \R\r%i", g_iUsed[ id ] );
   
    new szMenu = menu_create( szMenuName, "iContent" );
       
    new iCallBack  =  menu_makecallback( "CallBackMenu" );
   
    menu_additem( szMenu, "Antidot", "1", _, iCallBack );
    menu_additem( szMenu, "HE Grenade", "2", _, iCallBack );
    menu_additem( szMenu, "Zombie Spawn", "3", _, iCallBack );
    menu_additem( szMenu, "Ethereal", "4", _, iCallBack );
    menu_additem( szMenu, "M4A1 Gold", "5", _, iCallBack );
    menu_additem( szMenu, "Cameleon", "6", _, iCallBack );
    menu_additem( szMenu, "M32 Grenader", "7", _, iCallBack );
    menu_additem( szMenu, "Crossbow", "8", _, iCallBack );
   
    menu_setprop( sZmenu, MPROP_EXIT, MEXIT_ALL );
    menu_display( id, szMenu, 0 );
 
    g_iUsed[ id ] ++;
    return 1;
}

public iContent( id, szMenu, Item )
{
    if ( Item == MENU_EXIT )
    {
        menu_destroy( szMenu );
        return 1;
    }
   
    new iData[ 8 ], szName[ 32 ];
    new iAccess, iCallback;
   
    menu_item_getinfo( szMenu, Item, iAccess, iData, sizeof ( iData ) - 1, szName, sizeof ( szName ) - 1, iCallback );
   
    new iKeys = str_to_num( iData );
   
    switch ( iKeys )
    {
        case 1:
        {
        }
       
        case 2:
        {
        }
       
        case 3:
        {
        }
       
        case 4:
        {         
        }
       
        case 5:
        {
        }
       
        case 6:
        {
        }
        case 7:
        {
        }
       
        case 8:
        {
        }
   
    }
   
    menu_destroy( szMenu );
    return PLUGIN_HANDLED;
}

public CallBackMenu( id, szMenu, Item )
{   
    new iData[ 8 ], szName[ 32 ];
    new iAccess, iCallback;
   
    menu_item_getinfo( szMenu, Item, iAccess, iData, sizeof ( iData ) - 1, szName, sizeof ( szName ) - 1, iCallback );
   
    //if ( iData[ 0 ] == 0 )
   
    if( iData[ 0 ] == '1' )
    {
        if( g_bAntidot[ id ] )
            return ITEM_ENABLED;
    }
    else if( iData[ 0 ] == '2' )
    {
        if( g_bGrenade[ id ] )
            return ITEM_ENABLED;
    }
    else if( iData[ 0 ] == '3' )
    {
        if( g_bInfection[ id ] )
            return ITEM_ENABLED;
    }
    else if( iData[ 0 ] == '4' )
    {
        if( g_bEthereal[ id ] )
            return ITEM_ENABLED;
    }
    else if( iData[ 0 ] == '5' )
    {
        if( g_bGoldM4A1[ id ] )
            return ITEM_ENABLED;
    }
   
    else if( iData[ 0 ] == '6' )
    {
        if( g_bCameleon[ id ] )
            return ITEM_ENABLED;
    }
   
    else if( iData[ 0 ] == '7' )
    {
        if( g_bM32Grenader[ id ] )
            return ITEM_ENABLED;
    }
   
    else if( iData[ 0 ] == '8' )
    {
        if( g_bCrossBow[ id ] )
            return ITEM_ENABLED;
    }
   
    return ITEM_DISABLED;
}


MasKerT 07-25-2013 11:31

Re: Plugin VIP !
 
Now it works. But I want to know if it's possible to show all items on one page. I thought you can find a solution with all items on one page and exit button. Now show back and next buttons and I do not want it.

That's why I used.

PHP Code:

menu_setprop (szMenuMPROP_PERPAGE0); 


iBrazilian 07-25-2013 12:25

Re: Plugin VIP !
 
Quote:

Originally Posted by MasKerT (Post 1998523)
Now it works. But I want to know if it's possible to show all items on one page. I thought you can find a solution with all items on one page and exit button. Now show back and next buttons and I do not want it.

That's why I used.

PHP Code:

menu_setprop (szMenuMPROP_PERPAGE0); 


Glad it works.

No, last time I checked if there are more than 8 cases then it will show a next and back button.
If you don't want to show a next nor a back, I suggest you keep it exactly 8 cases or use a sub-menu which will create a back and next button either way.


All times are GMT -4. The time now is 06:31.

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