AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved ]Menu does not appear (https://forums.alliedmods.net/showthread.php?t=255036)

Freezo Begin 01-09-2015 17:32

[Solved ]Menu does not appear
 
read the title & see this script

Code:
#include <amxmodx> #define ADMIN_KICK_RANK "Basic Moderator" #define ADMIN_BAN_RANK "Co Moderator" /* #define Plug true */ /* #define GetPlayerBits(%1,%2)    ( %1 &     1 << ( %2 & 31 ) ) */ /* #define storefalse(%1) bIsbAdmin[%1] = true ; bIsbAdmin[%1] = true */ const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9) /* enum _:CVAR_DATA {     LOGIN,     REGISTER,     YELLOW } new const g_cvarXtrem[ CVAR_DATA ][ ] ={     "xtrem_login",     "xtrem_pw_limit",     "xtrem_wrong_punish" }; new const g_cvarValues[ CVAR_DATA ] = {     1,     1,     3 } */ new Registerdata[] [] = {     "\yMain Menu Xtrem^n^n" ,     "\r1. \wLogin as a \rXtrem Admin \w[\y%s\w]^n" ,     "\r2 . \wLogin as a \rNormal Admin" } new g_Adminrank[20]     /* bool:i_xtrem */ new bool:bIsbAdmin[33],     bool:bIsmAdmin[33]             /* new g_cvarPointer[ CVAR_DATA ]; */ public plugin_init() {     register_plugin("Xtrem [2% Loading ...]", "", "Freezo")     /*for( new i = 0; i < CVAR_DATA; i++ )         g_cvarPointer[ i ] = register_cvar( g_cvarXtrem[ i ], g_cvarValues[ i ] );  */ } public client_authorized(id){         /* storefalse(id) */         } public client_connect(id) {         /*     new szName[32]     get_user_name(id,szName,charsmax(szName))     */     if(is_user_alive(id)){         if(has_flg(id,ADMIN_ALL)){                             g_Adminrank = ADMIN_KICK_RANK                 bIsbAdmin[id] = true                         }         else if (has_flg(id,ADMIN_RCON))         {                 g_Adminrank = ADMIN_BAN_RANK                 bIsmAdmin[id] = true         }                 Choose_menu(id)     }     } public Choose_menu(id) {     static szMenu[ 1500 ], Len ; Len = 0         Len += formatex( szMenu[ Len ], sizeof szMenu - 1 - Len, Registerdata[0] );         Len += formatex( szMenu[ Len ], sizeof szMenu - 1 - Len, Registerdata[1] , g_Adminrank);         Len += formatex( szMenu[ Len ], sizeof szMenu - 1 - Len, Registerdata[2] );         show_menu( id, KEYSMENU, szMenu, - 1, "handler_show_menu" ); } public handler_show_menu( id, item, page ) {     /* There is no option for exit 'destroy menu ' */       switch( item )     {         case 0:         {                     }     } }     stock has_flg(id, FLAG) {     return (get_user_flags(id) & FLAG) } /*stock MSG_Print( Printmsg[] ) {         server_print( "%s%s" , CONSOLE_MSG , Printmsg )     } */

wickedd 01-09-2015 18:18

Re: Menu does not appear
 
Do you really think a player is alive when he is connecting to the server?

PHP Code:

public client_connect(id) {
    
    
/*
    new szName[32]
    get_user_name(id,szName,charsmax(szName))
    */
    
if(is_user_alive(id)){

        if(
has_flg(id,ADMIN_ALL)){
            
                
g_Adminrank ADMIN_KICK_RANK
                bIsbAdmin
[id] = true
                

        
}

        else if (
has_flg(id,ADMIN_RCON))
        {
                
g_Adminrank ADMIN_BAN_RANK
                bIsmAdmin
[id] = true
        
}
        
        
Choose_menu(id)
    }



Freezo Begin 01-09-2015 18:46

Re: Menu does not appear
 
Lol i miss that !

zmd94 01-09-2015 20:31

Re: Menu does not appear
 
Edit: So, to make it more clear:
PHP Code:

public client_connect(id) {
    
    
/*
    new szName[32]
    get_user_name(id,szName,charsmax(szName))
    */
    
if(is_user_alive(id)){

        if(
has_flg(id,ADMIN_ALL)){
            
                
g_Adminrank ADMIN_KICK_RANK
                bIsbAdmin
[id] = true
                

        
}

        else if (
has_flg(id,ADMIN_RCON))
        {
                
g_Adminrank ADMIN_BAN_RANK
                bIsmAdmin
[id] = true
        
}
        
        
Choose_menu(id)
    }


-->
PHP Code:

public client_putinserver(id
{
    if(
is_user_connected(id))
    {
        if(
has_flg(id,ADMIN_ALL)){
            
            
g_Adminrank ADMIN_KICK_RANK
            bIsbAdmin
[id] = true
        
}
        else if (
has_flg(id,ADMIN_RCON))
        {
            
g_Adminrank ADMIN_BAN_RANK
            bIsmAdmin
[id] = true
        
}
        
        
set_task(3.0"Choose_menu"id)
    }



wickedd 01-09-2015 21:14

Re: Menu does not appear
 
Quote:

Originally Posted by zmd94 (Post 2247216)
PHP Code:

public client_connect(id

-->
PHP Code:

public client_putinserver(id


Quote:

Originally Posted by wickedd (Post 2247160)
Do you really think a player is alive when he is connecting to the server?


Freezo Begin 01-10-2015 06:41

Re: Menu does not appear
 
Thanks for your reply .

Hey, zmd94 , your way is correct i don't understand why wickedd refuse it .

Back to the object , i don't have a problem with hooking client event i've just miss it .

what i wan't is : why the menu doesn't appear ?

zmd94 01-10-2015 06:47

Re: Menu does not appear
 
I recommend you to use new AMXX menu system. Just learn about it. ;)

https://forums.alliedmods.net/showthread.php?t=46364

Freezo Begin 01-10-2015 06:50

Re: Menu does not appear
 
Lol , i've already read it , but i prefer using a menu with keys ( PS : I've already test it with a simple menu in the first but its not working )

zmd94 01-10-2015 06:56

Re: Menu does not appear
 
So, actually how this plugin is working?

Freezo Begin 01-10-2015 07:07

Re: Menu does not appear
 
Back , sorry zmd its working thanks .


EDIT : ( well its unfinished what i've post ) If a admin is connected he check the acces then every acces has a string value that string value will add in the menu

[Solved]


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

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