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

join class bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilsquare
Junior Member
Join Date: Sep 2013
Old 11-18-2018 , 10:22   join class bug
Reply With Quote #1

I'm having problems with class selection.

I wanted to create a menu over the default class selection menu.

EXAMPLE:

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define PLUGIN_NAME "[CS] Class Custom"
#define PLUGIN_VERSION "2.0.1.8"
#define PLUGIN_AUTHOR "Eclipse*"

const PDATA_SAFE 2
const OFFSET_CSMENUCODE 205

new const CT_ClassNames[][] = { "Seal Team 6""GSG-9""SAS""GIGN" }
new const 
CT_ClassSysNames[][] = { "urban""gsg9""sas""gign" }

new const 
T_ClassNames[][] = { "Phoenix Connexion""Elite Crew""Arctic Avengers""Guerilla Warfare" }
new const 
T_ClassSysNames[][] = { "terror""leet""arctic""guerilla" }

public 
plugin_init() {
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
register_message(get_user_msgid("ShowMenu"), "FWD_ShowMenu")
    
register_message(get_user_msgid("VGUIMenu"), "FWD_VGUIMenu")
    
    
register_clcmd("jointeam""CLCMD_Team")
    
register_clcmd("chooseteam""CLCMD_Team")
    
register_clcmd("joinclass""CLCMD_Class")
}

public 
FWD_ShowMenu(MsgIDMsgDestid) {
    if (!
is_user_connected(id))
        return 
PLUGIN_CONTINUE;
    
    new 
MenuTXT[64]; get_msg_arg_string(4MenuTXTcharsmax(MenuTXT));
    
    if (
contain(MenuTXT"Team_Select")) {
        
MENU_Team(id)
        return 
PLUGIN_HANDLED
    
}
    
    else if (
contain(MenuTXT"Terrorist_Select") || contain(MenuTXT"CT_Select")) {
        
MENU_Class(idCsTeams:cs_get_user_team(id))
        return 
PLUGIN_HANDLED
    
}
    
    
//g_iMsgId[id] = MsgID
    
    
return PLUGIN_CONTINUE
}

public 
FWD_VGUIMenu(MsgIDMsgDestid) {
    if (!
is_user_connected(id))
        return 
PLUGIN_CONTINUE;
    
    if (
get_msg_arg_int(1) == PDATA_SAFE) {
        
MENU_Team(id)
        return 
PLUGIN_HANDLED
    
}
    else {
        if (
get_msg_arg_int(1) == 26 || get_msg_arg_int(1) == 27) {
            
MENU_Class(idCsTeams:cs_get_user_team(id))
            return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_CONTINUE
}

public 
CLCMD_Team(id) {
    
/*if (!Is_Valid_Connected(id))
        return PLUGIN_CONTINUE;*/
    
    //set_pdata_int(id, 125, get_pdata_int(id, 125, 5) & ~(1<<8), 5)
    
    
MENU_Team(id)
    
    return 
PLUGIN_HANDLED
}

public 
MENU_Team(id) {
    if (!
is_user_connected(id)) return PLUGIN_CONTINUE;
    
    new 
MenuTXT[1024]; formatex(MenuTXTcharsmax(MenuTXT), "\yMenu da Equipe:\d");
    new 
MenuIDMenuID menu_create(MenuTXT"SUBMENU_Team");
    
    
formatex(MenuTXTcharsmax(MenuTXT), "\wTerroristas")
    
menu_additem(MenuIDMenuTXT"1")
    
    
formatex(MenuTXTcharsmax(MenuTXT), "\wContra-Terroristas^n")
    
menu_additem(MenuIDMenuTXT"2")
    
    
formatex(MenuTXTcharsmax(MenuTXT), "\wEspectador^n")
    
menu_additem(MenuIDMenuTXT"3")
    
    
/*formatex(MenuTXT, charsmax(MenuTXT), "\wSelecionar Aleatoriamente^n")
    menu_additem(MenuID, MenuTXT, "4")*/
    
    
formatex(MenuTXTcharsmax(MenuTXT), "\wSair do Menu")
    
menu_setprop(MenuIDMPROP_EXITNAMEMenuTXT)
    
    if (
pev_valid(id) == PDATA_SAFE)
        
set_pdata_int(idOFFSET_CSMENUCODE0);
    
    
menu_display(idMenuID)
    return 
PLUGIN_HANDLED
}

public 
SUBMENU_Team(idMenuItem) {
    if (
Item == MENU_EXIT || !is_user_connected(id)) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
AccessInfo[4], Name[32], CallBack
    menu_item_getinfo
(MenuItemAccessInfocharsmax(Info), Namecharsmax(Name), CallBack)
    
    new 
KeyKey str_to_num(Info);
    
    switch (
Key) {
        case 
1: {
            
engclient_cmd(id"jointeam"Info)
            
MENU_Class(idCsTeams:Key)
        }
        case 
2: {
            
engclient_cmd(id"jointeam"Info)
            
MENU_Class(idCsTeams:Key)
        }
        case 
3engclient_cmd(id"jointeam"Info);
        
//case 4: Fm_JoinTeam(id, random_num(1, Key-1));
    
}
    
    return 
PLUGIN_HANDLED
}

public 
CLCMD_Class(id) {
    
/*if (!Is_Valid_Connected(id))
        return PLUGIN_CONTINUE;*/
    
    
MENU_Class(idcs_get_user_team(id))
    
    return 
PLUGIN_HANDLED
}

public 
MENU_Class(idCsTeams:Team) {
    if (!
is_user_connected(id)) return PLUGIN_CONTINUE;
    
    new 
MenuTXT[1024]; formatex(MenuTXTcharsmax(MenuTXT), "\yMenu das Classes:\d");
    new 
MenuIDMenuID menu_create(MenuTXT"SUBMENU_Class");
    
    if (
CsTeams:Team == CS_TEAM_T) {
        for (new 
0sizeof(T_ClassNames); I++) {
            
formatex(MenuTXTcharsmax(MenuTXT), "\w%s"T_ClassNames[I])
            new 
Num[4]; num_to_str(I+1Numcharsmax(Num));
            
menu_additem(MenuIDMenuTXTNum)
        }
    }
    else if (
CsTeams:Team == CS_TEAM_CT) {
        for (new 
0sizeof(CT_ClassNames); I++) {
            
formatex(MenuTXTcharsmax(MenuTXT), "\w%s"CT_ClassNames[I])
            new 
Num[4]; num_to_str(I+1Numcharsmax(Num));
            
menu_additem(MenuIDMenuTXTNum)
        }
    }
    else {
        
menu_destroy(MenuID)
        return 
PLUGIN_HANDLED
    
}
    
    
/*formatex(MenuTXT, charsmax(MenuTXT), "\wVoltar Pagina")
    menu_setprop(MenuID, MPROP_BACKNAME, MenuTXT)
    formatex(MenuTXT, charsmax(MenuTXT), "\wProxima Pagina")
    menu_setprop(MenuID, MPROP_NEXTNAME, MenuTXT)*/
    
formatex(MenuTXTcharsmax(MenuTXT), "\wSair do Menu")
    
menu_setprop(MenuIDMPROP_EXITNAMEMenuTXT)
    
    if (
pev_valid(id) == PDATA_SAFE)
        
set_pdata_int(idOFFSET_CSMENUCODE0);
    
    
menu_display(idMenuID)
    return 
PLUGIN_HANDLED
}

public 
SUBMENU_Class(idMenuItem) {
    if (
Item == MENU_EXIT || !is_user_connected(id) || cs_get_user_team(id) < CS_TEAM_T || cs_get_user_team(id) > CS_TEAM_CT) {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
AccessInfo[4], Name[32], CallBack
    menu_item_getinfo
(MenuItemAccessInfocharsmax(Info), Namecharsmax(Name), CallBack)
    
    new 
KeyKey str_to_num(Info);
    
    
/*if (!Get_Bitvar(g_Alive, id)) {
        dllfunc(
        //ExecuteHamB(Ham_CS_RoundRespawn, id)
        
        //Set_Bitvar(g_Alive, id)
    }*/
    
    
engclient_cmd(id"joinclass"Info)
    
    if (
cs_get_user_team(id) == CS_TEAM_T) {
        switch (
Key) {
            case 
1cs_set_user_model(idT_ClassSysNames[Key-1]);
            case 
2cs_set_user_model(idT_ClassSysNames[Key-1]);
            case 
3cs_set_user_model(idT_ClassSysNames[Key-1]);
            case 
4cs_set_user_model(idT_ClassSysNames[Key-1]);
        }
    }
    else {
        switch (
Key) {
            case 
1cs_set_user_model(idCT_ClassSysNames[Key-1]);
            case 
2cs_set_user_model(idCT_ClassSysNames[Key-1]);
            case 
3cs_set_user_model(idCT_ClassSysNames[Key-1]);
            case 
4cs_set_user_model(idCT_ClassSysNames[Key-1]);
        }
    }
    
    return 
PLUGIN_HANDLED

OBS: I am using a code a little different from this example but the functions are the same.

Last edited by devilsquare; 11-23-2018 at 12:20.
devilsquare is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-20-2018 , 08:20   Re: join class bug
Reply With Quote #2

and what seems to be your bug?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
devilsquare
Junior Member
Join Date: Sep 2013
Old 11-21-2018 , 01:26   Re: join class bug
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
and what seems to be your bug?
this message comes up shortly after I select the class

"This command is not available to you at this point"
devilsquare is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-22-2018 , 08:33   Re: join class bug
Reply With Quote #4

Can you please put your code in a PHP window and also indent your code so it's easier to read?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
devilsquare
Junior Member
Join Date: Sep 2013
Old 11-22-2018 , 21:33   Re: join class bug
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
Can you please put your code in a PHP window and also indent your code so it's easier to read?
could any moderator do this favor?

because I can not find such an option
*
devilsquare is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 11-23-2018 , 07:25   Re: join class bug
Reply With Quote #6

You should enter the code between this [php] text [/ php]
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
devilsquare
Junior Member
Join Date: Sep 2013
Old 11-23-2018 , 12:20   Re: join class bug
Reply With Quote #7

Quote:
Originally Posted by iceeedr View Post
You should enter the code between this [php] text [/ php]
Thank you very much.
devilsquare is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-25-2018 , 10:11   Re: join class bug
Reply With Quote #8

Quote:
Originally Posted by devilsquare View Post
this message comes up shortly after I select the class

"This command is not available to you at this point"
Does it happen when you join the server and join a class? when you change team? when exactly does it happen
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
devilsquare
Junior Member
Join Date: Sep 2013
Old 11-26-2018 , 15:05   Re: join class bug
Reply With Quote #9

Quote:
Originally Posted by Napoleon_be View Post
Does it happen when you join the server and join a class? when you change team? when exactly does it happen
join class
devilsquare is offline
devilsquare
Junior Member
Join Date: Sep 2013
Old 12-03-2018 , 03:36   Re: join class bug
Reply With Quote #10

the issue has been resolved, you can close the topic
devilsquare 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 01:15.


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