Raised This Month: $12 Target: $400
 3% 

Running 2 plugins, the second plugin menu options overwrite the first


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
csykosoma
Member
Join Date: Dec 2011
Old 12-30-2018 , 12:29   Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #1

I am running 2 plugins, when running the second plugin, the first plugin calls a menu and the menu options are filled with those from the second.

What can cause 2 separate plugins to overlap their menu options?
csykosoma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-30-2018 , 17:52   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #2

Only one menu can show at a time so they can't overlap. So, if they both show a menu at the same time, you'll only see that last one that executed.

Depending on the plugins, they might not be able to work together or they need to be updated to work differently.
__________________
fysiks is offline
csykosoma
Member
Join Date: Dec 2011
Old 12-31-2018 , 04:22   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #3

When the first plugin calls to open its menu, this second plugin below has it's menu options show instead. I am not sure at all if anyone could give me a an idea in the right direction towards fixing this. My best idea is to try to rewrite the menu options.

PHP Code:
/**
 * gameME Plugin
 * http://www.gameme.com
 * Copyright (C) 2007-2013 TTS Oetzel & Goerz GmbH
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#pragma dynamic 16000

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <cellarray>
#include <celltrie>
#include <fakemeta>
#include <hamsandwich>

new g_gameme_block_commands
new g_gameme_message_prefix
new Trie:g_blocked_commands

new g_msgSayText
new g_msgTeamInfo
new g_gameME_MainMenu
new g_gameME_AutoMenu
new g_gameME_EventsMenu
new Array:g_gameME_ColorArray

new ct_player_color = -1
new ts_player_color = -1

new logmessage_ignore[512]
new 
display_menu_keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9

new TeamNames[][] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}


public 
plugin_init()
{
    
register_plugin("gameME Plugin""2.3""TTS Oetzel & Goerz GmbH")
    
register_event("Damage""Event_Damage""b""2!0""3=0""4!0")
    
register_srvcmd("gameme_amx_psay",   "gameme_amx_psay",   0"<name or #userid><message> - sends private message")
    
register_srvcmd("gameme_amx_psay2",  "gameme_amx_psay2",  0"<name or #userid><colored><message> - sends green colored private message")
    
register_srvcmd("gameme_amx_say",    "gameme_amx_say",    0"<message> - sends message to all players")
    
register_srvcmd("gameme_amx_csay",   "gameme_amx_csay",   0"<message> - sends center hud message to all players")
    
register_srvcmd("gameme_amx_hint",   "gameme_amx_hint",   0"<name or #userid><message> - sends hint message")
    
register_srvcmd("gameme_amx_msay",   "gameme_amx_msay",   0"<userid><delay><message> - displays advanced information")
    
register_srvcmd("gameme_amx_browse""gameme_amx_browse"0"<userid><url> - displays internal browser")
    
register_srvcmd("gameme_amx_swap",   "gameme_amx_swap",   0"<userid> - swaps players to the opposite team")
    
    
RegisterHam(Ham_Spawn"player""client_spawn"1);
    
register_logevent("Event_Round_End"2"1=Round_End")  

    
// block origin gameME Stats command setup by default
    
g_blocked_commands TrieCreate()
    
TrieSetCell(g_blocked_commands"rank"1)
    
TrieSetCell(g_blocked_commands"/rank"1)
    
TrieSetCell(g_blocked_commands"!rank"1)
    
TrieSetCell(g_blocked_commands"skill"1)
    
TrieSetCell(g_blocked_commands"/skill"1)
    
TrieSetCell(g_blocked_commands"!skill"1)
    
TrieSetCell(g_blocked_commands"points"1)
    
TrieSetCell(g_blocked_commands"/points"1)
    
TrieSetCell(g_blocked_commands"!points"1)
    
TrieSetCell(g_blocked_commands"place"1)
    
TrieSetCell(g_blocked_commands"/place"1)
    
TrieSetCell(g_blocked_commands"!place"1)
    
TrieSetCell(g_blocked_commands"session"1)
    
TrieSetCell(g_blocked_commands"/session"1)
    
TrieSetCell(g_blocked_commands"!session"1)
    
TrieSetCell(g_blocked_commands"sdata"1)
    
TrieSetCell(g_blocked_commands"/sdata"1)
    
TrieSetCell(g_blocked_commands"!sdata"1)
    
TrieSetCell(g_blocked_commands"kpd"1)
    
TrieSetCell(g_blocked_commands"/kpd"1)
    
TrieSetCell(g_blocked_commands"!kpd"1)
    
TrieSetCell(g_blocked_commands"kdratio"1)
    
TrieSetCell(g_blocked_commands"/kdratio"1)
    
TrieSetCell(g_blocked_commands"!kdratio"1)
    
TrieSetCell(g_blocked_commands"kdeath"1)
    
TrieSetCell(g_blocked_commands"/kdeath"1)
    
TrieSetCell(g_blocked_commands"!kdeath"1)
    
TrieSetCell(g_blocked_commands"next"1)
    
TrieSetCell(g_blocked_commands"/next"1)
    
TrieSetCell(g_blocked_commands"!next"1)
    
TrieSetCell(g_blocked_commands"load"1)
    
TrieSetCell(g_blocked_commands"/load"1)
    
TrieSetCell(g_blocked_commands"!load"1)
    
TrieSetCell(g_blocked_commands"status"1)
    
TrieSetCell(g_blocked_commands"/status"1)
    
TrieSetCell(g_blocked_commands"!status"1
    
TrieSetCell(g_blocked_commands"top20"1)
    
TrieSetCell(g_blocked_commands"/top20"1)
    
TrieSetCell(g_blocked_commands"!top20"1)
    
TrieSetCell(g_blocked_commands"top10"1)
    
TrieSetCell(g_blocked_commands"/top10"1)
    
TrieSetCell(g_blocked_commands"!top10"1)
    
TrieSetCell(g_blocked_commands"top5"1)
    
TrieSetCell(g_blocked_commands"/top5"1)
    
TrieSetCell(g_blocked_commands"!top5"1)
    
TrieSetCell(g_blocked_commands"maps"1)
    
TrieSetCell(g_blocked_commands"/maps"1)
    
TrieSetCell(g_blocked_commands"!maps"1)
    
TrieSetCell(g_blocked_commands"map_stats"1)
    
TrieSetCell(g_blocked_commands"/map_stats"1)
    
TrieSetCell(g_blocked_commands"!map_stats"1)
    
TrieSetCell(g_blocked_commands"clans"1)
    
TrieSetCell(g_blocked_commands"/clans"1)
    
TrieSetCell(g_blocked_commands"!clans"1)
    
TrieSetCell(g_blocked_commands"cheaters"1)
    
TrieSetCell(g_blocked_commands"/cheaters"1)
    
TrieSetCell(g_blocked_commands"!cheaters"1)
    
TrieSetCell(g_blocked_commands"statsme"1)
    
TrieSetCell(g_blocked_commands"/statsme"1)
    
TrieSetCell(g_blocked_commands"!statsme"1)
    
TrieSetCell(g_blocked_commands"weapons"1)
    
TrieSetCell(g_blocked_commands"/weapons"1)
    
TrieSetCell(g_blocked_commands"!weapons"1)
    
TrieSetCell(g_blocked_commands"weapon"1)
    
TrieSetCell(g_blocked_commands"/weapon"1)
    
TrieSetCell(g_blocked_commands"!weapon"1)
    
TrieSetCell(g_blocked_commands"action"1)
    
TrieSetCell(g_blocked_commands"/action"1)
    
TrieSetCell(g_blocked_commands"!action"1)
    
TrieSetCell(g_blocked_commands"actions"1)
    
TrieSetCell(g_blocked_commands"/actions"1)
    
TrieSetCell(g_blocked_commands"!actions"1)
    
TrieSetCell(g_blocked_commands"accuracy"1)
    
TrieSetCell(g_blocked_commands"/accuracy"1)
    
TrieSetCell(g_blocked_commands"!accuracy"1)
    
TrieSetCell(g_blocked_commands"targets"1)
    
TrieSetCell(g_blocked_commands"/targets"1)
    
TrieSetCell(g_blocked_commands"!targets"1)
    
TrieSetCell(g_blocked_commands"target"1)
    
TrieSetCell(g_blocked_commands"/target"1)
    
TrieSetCell(g_blocked_commands"!target"1)
    
TrieSetCell(g_blocked_commands"kills"1)
    
TrieSetCell(g_blocked_commands"/kills"1)
    
TrieSetCell(g_blocked_commands"!kills"1)
    
TrieSetCell(g_blocked_commands"kill"1)
    
TrieSetCell(g_blocked_commands"/kill"1)
    
TrieSetCell(g_blocked_commands"!kill"1)
    
TrieSetCell(g_blocked_commands"player_kills"1)
    
TrieSetCell(g_blocked_commands"/player_kills"1)
    
TrieSetCell(g_blocked_commands"!player_kills"1)
    
TrieSetCell(g_blocked_commands"cmds"1)
    
TrieSetCell(g_blocked_commands"/cmds"1)
    
TrieSetCell(g_blocked_commands"!cmds"1)
    
TrieSetCell(g_blocked_commands"commands"1)
    
TrieSetCell(g_blocked_commands"/commands"1)
    
TrieSetCell(g_blocked_commands"!commands"1)
    
TrieSetCell(g_blocked_commands"gameme_display 0"1)
    
TrieSetCell(g_blocked_commands"/gameme_display 0"1)
    
TrieSetCell(g_blocked_commands"!gameme_display 0"1)
    
TrieSetCell(g_blocked_commands"gameme_display 1"1)
    
TrieSetCell(g_blocked_commands"/gameme_display 1"1)
    
TrieSetCell(g_blocked_commands"!gameme_display 1"1)
    
TrieSetCell(g_blocked_commands"gameme_atb 0"1)
    
TrieSetCell(g_blocked_commands"/gameme_atb 0"1)
    
TrieSetCell(g_blocked_commands"!gameme_atb 0"1)
    
TrieSetCell(g_blocked_commands"gameme_atb 1"1)
    
TrieSetCell(g_blocked_commands"/gameme_atb 1"1)
    
TrieSetCell(g_blocked_commands"!gameme_atb 1"1)
    
TrieSetCell(g_blocked_commands"gameme_hideranking"1)
    
TrieSetCell(g_blocked_commands"/gameme_hideranking"1)
    
TrieSetCell(g_blocked_commands"!gameme_hideranking"1)
    
TrieSetCell(g_blocked_commands"gameme_reset"1)
    
TrieSetCell(g_blocked_commands"/gameme_reset"1)
    
TrieSetCell(g_blocked_commands"!gameme_reset"1)
    
TrieSetCell(g_blocked_commands"gameme_chat 0"1)
    
TrieSetCell(g_blocked_commands"/gameme_chat 0"1)
    
TrieSetCell(g_blocked_commands"!gameme_chat 0"1)
    
TrieSetCell(g_blocked_commands"gameme_chat 1"1)
    
TrieSetCell(g_blocked_commands"/gameme_chat 1"1)
    
TrieSetCell(g_blocked_commands"!gameme_chat 1"1)
    
TrieSetCell(g_blocked_commands"gstats"1)
    
TrieSetCell(g_blocked_commands"/gstats"1)
    
TrieSetCell(g_blocked_commands"!gstats"1)
    
TrieSetCell(g_blocked_commands"global_stats"1)
    
TrieSetCell(g_blocked_commands"/global_stats"1)
    
TrieSetCell(g_blocked_commands"!global_stats"1)
    
TrieSetCell(g_blocked_commands"gameme"1)
    
TrieSetCell(g_blocked_commands"/gameme"1)
    
TrieSetCell(g_blocked_commands"!gameme"1)
    
TrieSetCell(g_blocked_commands"gameme_menu"1)
    
TrieSetCell(g_blocked_commands"/gameme_menu"1)
    
TrieSetCell(g_blocked_commands"!gameme_menu"1)

    
register_cvar("gameme_plugin_version""2.3 (HL1)"FCVAR_SPONLY|FCVAR_SERVER)
    
register_cvar("gameme_webpage""http://www.gameme.com"FCVAR_SPONLY|FCVAR_SERVER)
    
g_gameme_block_commands register_cvar("gameme_block_commands""1")
    
register_srvcmd("gameme_block_commands_values""gameme_block_commands_values"0"<string> - adds blocked chect commands")
    
g_gameme_message_prefix register_cvar("gameme_message_prefix""")
    
    
register_event("TextMsg",  "client_joinedteam",     "a""2=#Game_join_ct""2=#Game_join_terrorist")
    
register_event("DeathMsg""client_kill",           "a""1>0")
    
    
// building the menus only once
    
g_gameME_MainMenu menu_create("gameME - Main Menu""mainmenu_handle")
    
menu_additem(g_gameME_MainMenu"Display Rank",            "1")
    
menu_additem(g_gameME_MainMenu"Next Players",            "2")
    
menu_additem(g_gameME_MainMenu"Top10 Players",           "3")
    
menu_additem(g_gameME_MainMenu"Clans Ranking",           "4")
    
menu_additem(g_gameME_MainMenu"Server Status",           "5")
    
menu_additem(g_gameME_MainMenu"Statsme",                 "6")
    
menu_additem(g_gameME_MainMenu"Auto Ranking",            "7")
    
menu_additem(g_gameME_MainMenu"Console Events",          "8")
    
menu_additem(g_gameME_MainMenu"Weapon Usage",            "9")
    
menu_additem(g_gameME_MainMenu"Weapons Accuracy",       "10")
    
menu_additem(g_gameME_MainMenu"Weapons Targets",        "11")
    
menu_additem(g_gameME_MainMenu"Player Kills",           "12")
    
menu_additem(g_gameME_MainMenu"Toggle Ranking Display""13")
    
menu_additem(g_gameME_MainMenu"Reset Statistics",       "14")
    
menu_additem(g_gameME_MainMenu"VAC Cheaterlist",        "15")
    
menu_additem(g_gameME_MainMenu"Display Help",           "16")

    
g_gameME_AutoMenu menu_create("gameME - Auto-Ranking""automenu_handle")
    
menu_additem(g_gameME_AutoMenu"Enable on round-start",   "1")
    
menu_additem(g_gameME_AutoMenu"Enable on round-end",     "2")
    
menu_additem(g_gameME_AutoMenu"Enable on player death",  "3")
    
menu_additem(g_gameME_AutoMenu"Disable",                 "4")
    
menu_setprop(g_gameME_AutoMenuMPROP_PERPAGE0)

    
g_gameME_EventsMenu menu_create("gameME - Console Events""eventsmenu_handle")
    
menu_additem(g_gameME_EventsMenu"Enable Events",         "1")
    
menu_additem(g_gameME_EventsMenu"Disable Events",        "2")
    
menu_additem(g_gameME_EventsMenu"Enable Global Chat",    "3")
    
menu_additem(g_gameME_EventsMenu"Disable Global Chat",   "4")
    
menu_setprop(g_gameME_EventsMenuMPROP_PERPAGE0)

    
register_menucmd(register_menuid("Display Menu"), display_menu_keys"handle_internal_menu")
    
register_clcmd("say",        "gameme_block_commands")
    
register_clcmd("say_team",    "gameme_block_commands")

    
ct_player_color = -1
    ts_player_color 
= -1
    find_player_team_slot
("CT")
    
find_player_team_slot("TERRORIST")

    
g_msgSayText get_user_msgid("SayText"
    
g_msgTeamInfo get_user_msgid("TeamInfo"
    
g_gameME_ColorArray ArrayCreate()
    
    
register_forward(FM_AlertMessage"game_log_hook")
}


public 
log_player_event(clientverb[32], player_event[192], display_location)
{
    if ((
client 0) && (is_user_connected(client))) {
        new 
player_userid get_user_userid(client)

        static 
player_authid[32]
        
get_user_authid(clientplayer_authid31)

        static 
player_name[32]
        
get_user_name(clientplayer_name31)

        static 
player_team[16]
        
get_user_team(clientplayer_team15)

        if (
display_location 0) {
            new 
player_origin[3]
            
get_user_origin (clientplayer_origin)

            
format(logmessage_ignore511"^"%s<%d><%s><%s>^" %s ^"%s^""player_nameplayer_useridplayer_authidplayer_teamverbplayer_event)
            
log_message("^"%s<%d><%s><%s>^" %s ^"%s^" (position ^"%%%d^")"player_nameplayer_useridplayer_authidplayer_teamverbplayer_eventplayer_origin[0], player_origin[1], player_origin[2])
        } else {
            
log_message("^"%s<%d><%s><%s>^" %s ^"%s^""player_nameplayer_useridplayer_authidplayer_teamverbplayer_event)
        }
    }
}


public 
game_log_hook(AlertTypetypemessage[])
{
    if (
type != at_logged ) {
        return 
FMRES_IGNORED
    
}
    if ((
strcmp(""logmessage_ignore) != 0) && (contain(messagelogmessage_ignore) != -1)) {
        if (
contain(message"position") == -1) {
            
logmessage_ignore ""
            
return FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}


stock find_player_team_slot(team[16]) 
{

    new 
team_index get_team_index(team)
    if (
team_index > -1) {
        if (
strcmp(team"CT") == 0) {
            
ct_player_color = -1
        
} else if (strcmp(team"TERRORIST") == 0) {
            
ts_player_color = -1
        
}

        new 
max_clients get_maxplayers()
        for(new 
1<= max_clientsi++) {
            new 
player_index i
            
if (is_user_connected(player_index)) {
                static 
player_team[16]
                
get_user_team(player_indexplayer_team15)

                if (
strcmp(player_teamteam) == 0) {
                    if (
strcmp(team"CT") == 0) {
                        
ct_player_color player_index
                        
if (ts_player_color == ct_player_color) {
                            
ct_player_color = -1
                            ts_player_color 
= -1
                        
}
                        break
                    } else if (
strcmp(team"TERRORIST") == 0) {
                        
ts_player_color player_index
                        
if (ts_player_color == ct_player_color) {
                            
ct_player_color = -1
                            ts_player_color 
= -1
                        
}
                        break
                    }
                }
            }
        }
    }
}


public 
validate_team_colors() 
{
    if (
ct_player_color > -1) {
        if (
is_user_connected(ct_player_color)) {
            static 
player_team[16]
            
get_user_team(ct_player_colorplayer_team15)
            if (
strcmp("CT"player_team) != 0) {
                
ct_player_color = -1
            
}
        } else {
            
ct_player_color = -1
        
}
    } else if (
ts_player_color > -1) {
        if (
is_user_connected(ts_player_color)) {
            static 
player_team[16]
            
get_user_team(ts_player_colorplayer_team15)
            if (
strcmp("TERRORIST"player_team) != 0) {
                
ts_player_color = -1
            
}
        } else {
            
ts_player_color = -1
        
}
    }
    if ((
ct_player_color == -1) || (ts_player_color == -1)) {
        if (
ct_player_color == -1) {
            
find_player_team_slot("CT")
        }
        if (
ts_player_color == -1) {
            
find_player_team_slot("TERRORIST")
        }
    }
}


stock get_team_index(team_name[16])
{
    if (
strcmp(team_name"TERRORIST") == 0) {
        return 
0
    
} else if (strcmp(team_name"CT") == 0) {
        return 
1
    
}
    return -
1
}


stock remove_color_entities(message[192])
{
    
replace_all(message192"x04""")
    
replace_all(message192"x03""")
    
replace_all(message192"x01""")
}


stock color_entities(message[192])
{
    new 
replace_message[2]
    
replace_message[0] = 0x04
    replace_all
(message192"x04"replace_message)
    
replace_message[0] = 0x03
    replace_all
(message192"x03"replace_message)
    
replace_message[0] = 0x01
    replace_all
(message192"x01"replace_message)
}


stock color_team_entities(message[192])
{
    if (
ts_player_color > -1) {
        if (
contain(message"TERRORIST") > -1) {
            new 
replace_message[192]
            
replace_message[0] = 0x03
            format
(replace_message[1], 191"%s""TERRORIST")
            
replace_message[strlen("TERRORIST") + 1] = 0x01
            replace_all
(message192"TERRORIST"replace_message)
            return 
ts_player_color
        
}
    } 
    if (
ct_player_color > -1) {
        if (
contain(message"CT") > -1) {
            new 
replace_message[192]
            
replace_message[0] = 0x03
            format
(replace_message[1], 191"%s""CT")
            
replace_message[strlen("CT") + 1] = 0x01
            replace_all
(message192"CT"replace_message)
            return 
ct_player_color
        
}
    }
    
    return -
1
}


stock color_player(color_typeplayer_indexclient_message[192]) 
{
    new 
color_player_index = -1
    
static client_name[192]
    
get_user_name(player_indexclient_name191)
    if (
color_type == 1) {
        new 
colored_player_name[192]
        
colored_player_name[0] = 0x03
        format
(colored_player_name[1], 191"%s"client_name)
        
colored_player_name[strlen(client_name) + 1] = 0x01

        
if (contain(client_messageclient_name) > -1) {
            
replace_all(client_message192client_namecolored_player_name)
            return 
player_index
        
}
    } else {
        new 
colored_player_name[192]
        
colored_player_name[0] = 0x04
        format
(colored_player_name[1], 191"%s"client_name)
        
colored_player_name[strlen(client_name) + 1] = 0x01

        
if (contain(client_messageclient_name) > -1) {
             
replace_all(client_message192client_namecolored_player_name)
          }
    }
    return 
color_player_index
}


stock color_all_players(message[192]) 
{
    new 
color_index = -1
    ArrayClear
(g_gameME_ColorArray)

    new 
lowest_matching_pos 192
    
new lowest_matching_pos_client = -1

    
new max_clients get_maxplayers()
    for(new 
1<= max_clientsi++) {

        new 
client i
        
if (is_user_connected(client)) {
            static 
client_name[192]
            
get_user_name(clientclient_name191)
            new 
message_pos contain(messageclient_name)
            if (
message_pos > -1) {
                if (
lowest_matching_pos message_pos) {
                    
lowest_matching_pos message_pos
                    lowest_matching_pos_client 
client
                
}
                new 
TempPlayerColorArray[1]
                
TempPlayerColorArray[0] = client
                ArrayPushArray
(g_gameME_ColorArrayTempPlayerColorArray)
            }
        }
    }

    new 
size ArraySize(g_gameME_ColorArray)
    for (new 
0sizei++) {
        new 
temp_player_array[1]
        
ArrayGetArray(g_gameME_ColorArrayitemp_player_array)
        new 
temp_client temp_player_array[0]
        if (
temp_client == lowest_matching_pos_client) {
            new 
temp_color_index color_player(1temp_clientmessage)
            
color_index temp_color_index
        
} else {
            
color_player(0temp_clientmessage)
        }
    }
    
ArrayClear(g_gameME_ColorArray)
    
    return 
color_index
}


stock get_player_index(client)
{
    if (
client 0) {
        new 
Players[32]
        new 
player_counttemp_player_index
        get_players
(Playersplayer_count"ch")
        for (
temp_player_index 0temp_player_index player_counttemp_player_index++) {
            new 
player Players[temp_player_index
            new 
temp_user_id get_user_userid(player)
            if (
temp_user_id == client) {
               return 
player;
            }
        }
        return -
1;
    }
    return -
1;
}


public 
client_kill()
{
 
    new 
killer_id   read_data(1)
    new 
victim_id   read_data(2)
    new 
is_headshot read_data(3)
    new 
weapon[32]
    
read_data(4weapon31)

    if ((
killer_id 0) && (is_user_connected(killer_id))) {

        new 
suicide 0
        
if (killer_id == victim_id) {
            
suicide 1
        
}
        
        static 
killer_name[32], killer_team[16], killer_authid[32]
        new 
killer_userid get_user_userid(killer_id)

        
get_user_name(killer_idkiller_name31)
        
get_user_team(killer_idkiller_team15)
        
get_user_authid(killer_idkiller_authid31)

        new 
killer_origin[3]
        
get_user_origin (killer_idkiller_origin)

        if (
suicide == 0) {
            if ((
victim_id 0) && (is_user_connected(victim_id))) {

                static 
victim_name[32], victim_team[16], victim_authid[32]
                new 
victim_userid get_user_userid(victim_id)
 
                
get_user_name(victim_idvictim_name31)
                
get_user_team(victim_idvictim_team15)
                
get_user_authid(victim_idvictim_authid31)

                new 
victim_origin[3]
                
get_user_origin (victim_idvictim_origin)

                
format(logmessage_ignore511"^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
                    
killer_namekiller_useridkiller_authidkiller_team
                    
victim_namevictim_useridvictim_authidvictim_team
                    
weapon)
                
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^" (attacker_position ^"%%%d^") (victim_position ^"%%%d^")",
                    
killer_namekiller_useridkiller_authidkiller_team
                    
victim_namevictim_useridvictim_authidvictim_team
                    
weapon
                    
killer_origin[0], killer_origin[1], killer_origin[2],
                    
victim_origin[0], victim_origin[1], victim_origin[2])

                if (
is_headshot 0) {
                    
log_message("^"%s<%d><%s><%s>^" triggered ^"headshot^""killer_namekiller_useridkiller_authidkiller_team)
                }
            }
        } else {
            
format(logmessage_ignore511"^"%s<%d><%s><%s>^" committed suicide with ^"%s^"",
                
killer_namekiller_useridkiller_authidkiller_teamweapon)
            
log_message("^"%s<%d><%s><%s>^" committed suicide with ^"%s^" (attacker_position ^"%%%d^")",
                
killer_namekiller_useridkiller_authidkiller_teamweapon
                
killer_origin[0], killer_origin[1], killer_origin[2])
        }
    }
 
}


public 
client_joinedteam()
{
    new 
id read_data(1)
    if ((
id 0) && (is_user_connected(id))) {
        if ((
ct_player_color == -1) || (id == ct_player_color)) {
            
ct_player_color = -1
        
} else if ((ts_player_color == -1) || (id == ts_player_color)) {
            
ts_player_color = -1
        
}
    }
}


public 
dump_weaponstats(id)
{
    if ((
id 0) && (is_user_connected(id))) {
        new 
iStats[8], iHits[8]
        static 
szTeam[16], szName[32], szAuthid[32], szWeapon[24]
        new 
iUserid get_user_userid(id)
        new 
_max xmod_get_maxweapons()
    
        
get_user_team(idszTeam15)
        
get_user_name(idszName31)
        
get_user_authid(idszAuthid31)

        for (new 
1_max; ++i) {
            if (
get_user_wstats(idiiStatsiHits)) {
                
xmod_get_wpnname(iszWeapon23)
            
                
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")"
                            
szNameiUseridszAuthidszTeamszWeaponiStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1])
                
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")"
                            
szNameiUseridszAuthidszTeamszWeaponiHits[1], iHits[2], iHits[3], iHits[4], iHits[5], iHits[6], iHits[7])
            }
        }
    }
}


public 
client_disconnect(id)
{
    if ((
id 0) && (is_user_connected(id))) {
        if ((
ct_player_color == -1) || (id == ct_player_color)) {
            
ct_player_color = -1
        
} else if ((ts_player_color == -1) || (id == ts_player_color)) {
            
ts_player_color = -1
        
}
    }
}


public 
client_spawn(id)
{
    if (
is_user_alive(id)) {
        
reset_user_wstats(id)
    }
}


public 
client_death(killervictimwpnindexhitplacetk)
{
    
dump_weaponstats(victim)
}


public 
Event_Round_End()
{
    new 
max_clients get_maxplayers()
    for(new 
1<= max_clientsi++) {
        if (
is_user_alive(i)) {
            
dump_weaponstats(i)
        }
    }
}


public 
Event_Damage(id)
{
    if ((
id 0) && (is_user_connected(id))) {
        new 
VictimUserid get_user_userid(id)
        static 
VictimTeam[16], VictimName[32], VictimAuthid[32]
        
get_user_team(id,   VictimTeam15)
        
get_user_name(id,   VictimName31)
        
get_user_authid(idVictimAuthid31)

        new 
iAttackerWeaponiAttackerBody
        
new iAttacker get_user_attacker(idiAttackerWeaponiAttackerBody)

        if ((
iAttacker != 0) || (iAttacker != id)) {
            if (
iAttackerWeapon 0) {
                new 
AttackerUserid get_user_userid(iAttacker)
                static 
AttackerTeam[16], AttackerWeaponName[24], AttackerName[32], AttackerAuthid[32]
                
get_user_team(iAttacker,   AttackerTeam15)
                
get_user_name(iAttacker,   AttackerName31)
                
get_user_authid(iAttackerAttackerAuthid31)
                
xmod_get_wpnname(iAttackerWeaponAttackerWeaponName23)
        
                new 
AttackerHitzone[32] = "unknown"
        
                
if (iAttackerBody == HIT_GENERIC) {
                  
AttackerHitzone "generic"
                
} else if (iAttackerBody == HIT_HEAD) {
                  
AttackerHitzone "head"
                
} else if (iAttackerBody == HIT_CHEST) {
                  
AttackerHitzone "chest"
                
} else if (iAttackerBody == HIT_STOMACH) {
                  
AttackerHitzone "stomach"
                
} else if (iAttackerBody == HIT_LEFTARM) {
                  
AttackerHitzone "left arm"
                
} else if (iAttackerBody == HIT_RIGHTARM) {
                  
AttackerHitzone "right arm"
                
} else if (iAttackerBody == HIT_LEFTLEG) {
                  
AttackerHitzone "left leg"
                
} else if (iAttackerBody == HIT_RIGHTLEG) {
                  
AttackerHitzone "right leg"
                
}
        
                
log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"%s^" (damage ^"0^") (damage_armor ^"0^") (health ^"0^") (armor ^"0^") (hitgroup ^"%s^")"
                            
AttackerNameAttackerUseridAttackerAuthidAttackerTeam
                            
VictimNameVictimUseridVictimAuthidVictimTeam,
                            
AttackerWeaponNameAttackerHitzone)
            }                        
        }    
    }
    return 
PLUGIN_CONTINUE
    
}


public 
gameme_block_commands_values(idlevelcid)
{
    if (!
cmd_access(idlevelcid2)) {
        return 
PLUGIN_HANDLED
    
}
    
    static 
commands[192]
    
read_argv(1commands191)

    if (
strcmp(commands"clear") == 0) {
        
TrieClear(g_blocked_commands)
        
log_message("Server triggered ^"%s^"""blocked_commands_cleared")
    } else {
        if (
strcmp(commands"") != 0) {
            if (
contain(commands" ") > -1) {
                new 
index 0
                
new length strlen(commands
                static 
temp_command[64]
                new 
temp_length copyc(temp_command63commands' ') + 1
                TrieSetCell
(g_blocked_commandstemp_command1);
                while((
temp_length length) && (++index 10)) { 
                    
temp_length += copyc(temp_command63commands[temp_length], ' ') + 1
                    TrieSetCell
(g_blocked_commandstemp_command1);
                }
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}


public 
gameme_amx_psay(idlevelcid)
{
    if (!
cmd_access(idlevelcid3)) {
        return 
PLUGIN_HANDLED
    
}
    
    static 
client_id[192]
    
read_argv(1client_id191)
    new 
message_recipients[32][16];
    new 
recipients_count 0;
    if (
contain(client_id",") > -1) {
        new 
index 0
        
new length strlen(client_id
        new 
temp_length copyc(message_recipients[index], 15client_id',') + 1
        
while((temp_length length) && (++index 31)) { 
            
temp_length += copycmessage_recipients[index], 15client_id[temp_length], ',') + 1
        
}
        
recipients_count index 1;
    } else {
        if (
contain(client_id"#") > -1) {
            
copy(message_recipients[0], 15client_id[1]) 
        } else {
            
copy(message_recipients[0], 15client_id
        }
        
recipients_count 1;
    }

    if (
recipients_count 0) {

        static 
colored_param[32]
        
read_argv(2colored_param31)
        new 
is_colored 0
        
new ignore_param 0
        
if (strcmp(colored_param"1") == 0) {
            
is_colored 1
            ignore_param 
1
        
}
        if (
strcmp(colored_param"0") == 0) {
            
ignore_param 1
        
}

        new 
argument_count read_argc()
        new 
client_message[192]
        for(new 
= (ignore_param); argument_counti++) {
            static 
temp_argument[192]
            
read_argv(1temp_argument191)
            if (
> (ignore_param)) {
                if ((
191 strlen(client_message)) > strlen(temp_argument)) {
                    if ((
temp_argument[0] == 41) || (temp_argument[0] == 125)) {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else if ((
strlen(client_message) > 0) && (client_message[strlen(client_message)-1] != 40) && (client_message[strlen(client_message)-1] != 123) && (client_message[strlen(client_message)-1] != 58) && (client_message[strlen(client_message)-1] != 39) && (client_message[strlen(client_message)-1] != 44)) {
                        if ((
strcmp(temp_argument":") != 0) && (strcmp(temp_argument",") != 0) && (strcmp(temp_argument"'") != 0)) {
                            
client_message[strlen(client_message)] = 32
                        
}
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    }
                }
            } else {
                if ((
192 strlen(client_message)) > strlen(temp_argument)) {
                    
copy(client_message[strlen(client_message)], 191temp_argument)
                }
            }
        }

        new 
color_index = -1
        
static display_message[192]
        if (
is_colored 0) {
            new 
player_color_index color_all_players(client_message)
            if (
player_color_index > -1) {
                
color_index player_color_index
            
} else {
                
validate_team_colors()
                
color_index color_team_entities(client_message)
            }
            
color_entities(client_message)
        }

        static 
message_prefix[64]
        
get_pcvar_string(g_gameme_message_prefixmessage_prefix64)
        if (
strcmp(message_prefix"") == 0) {
            
display_message[0] = 0x01
            format
(display_message[1], 191"%s"client_message)
        } else {
            
display_message[0] = 0x04
            format
(display_message[1], 191"%s"message_prefix)
            
display_message[strlen(message_prefix) + 1] = 0x01
            format
(display_message[strlen(message_prefix) + 2], 192 - (strlen(message_prefix) + 2), " %s"client_message)
        }
        
        new 
setup_color_for_recipients 0;
        if (
color_index == -1) {
            
setup_color_for_recipients 1;
        }
        
        for (new 
0recipients_counti++) {
            new 
client str_to_num(message_recipients[i])
            if (
client 0) {
                new 
player_index get_player_index(client);
                if ((
player_index 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) {

                    if (
setup_color_for_recipients == 1) {
                        
color_index player_index;
                    }

                    new 
player_team get_user_team(player_index)
                    new 
color_team = -1
                    
if (is_user_connected(color_index)) {
                        
color_team get_user_team(color_index)
                    }
            
                    if ((
player_team != color_team) && (color_team > -1) && (color_team <= 3)) {
                        
message_begin(MSG_ONEg_msgTeamInfo, {0,0,0}, player_index)
                        
write_byte(player_index)
                        
write_string(TeamNames[color_team])
                        
message_end()
                    }

                    
message_begin(MSG_ONEg_msgSayText, {0,0,0}, player_index)
                    if (
is_user_connected(color_index)) {
                        
write_byte(color_index)
                    } else {
                        
write_byte(player_index)
                    }
                    
write_string(display_message)
                    
message_end()

                    if ((
player_team != color_team) && (player_team > -1) && (player_team <= 3)) {
                        
message_begin(MSG_ONEg_msgTeamInfo, {0,0,0}, player_index)
                        
write_byte(player_index)
                        
write_string(TeamNames[player_team])
                        
message_end()
                    }
                }    
            }
        }

    }
    
    return 
PLUGIN_HANDLED
}


public 
gameme_amx_psay2(idlevelcid)
{
    if (!
cmd_access(idlevelcid3)) {
        return 
PLUGIN_HANDLED
    
}

    static 
client_id[192]
    
read_argv(1client_id191)
    new 
message_recipients[32][16];
    new 
recipients_count 0;
    if (
contain(client_id",") > -1) {
        new 
index 0
        
new length strlen(client_id
        new 
temp_length copyc(message_recipients[index], 15client_id',') + 1
        
while((temp_length length) && (++index 31)) { 
            
temp_length += copycmessage_recipients[index], 15client_id[temp_length], ',') + 1
        
}
        
recipients_count index 1;
    } else {
        if (
contain(client_id"#") > -1) {
            
copy(message_recipients[0], 15client_id[1]) 
        } else {
            
copy(message_recipients[0], 15client_id
        }
        
recipients_count 1;
    }

    if (
recipients_count 0) {

        static 
colored_param[32]
        
read_argv(2colored_param31)
        new 
ignore_param 0
        
if (strcmp(colored_param"1") == 0) {
            
ignore_param 1
        
}
        if (
strcmp(colored_param"0") == 0) {
            
ignore_param 1
        
}

        new 
argument_count read_argc()
        new 
client_message[192]
        for(new 
= (ignore_param); argument_counti++) {
            static 
temp_argument[192]
            
read_argv(1temp_argument191)
            if (
> (ignore_param)) {
                if ((
191 strlen(client_message)) > strlen(temp_argument)) {
                    if ((
temp_argument[0] == 41) || (temp_argument[0] == 125)) {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else if ((
strlen(client_message) > 0) && (client_message[strlen(client_message)-1] != 40) && (client_message[strlen(client_message)-1] != 123) && (client_message[strlen(client_message)-1] != 58) && (client_message[strlen(client_message)-1] != 39) && (client_message[strlen(client_message)-1] != 44)) {
                        if ((
strcmp(temp_argument":") != 0) && (strcmp(temp_argument",") != 0) && (strcmp(temp_argument"'") != 0)) {
                            
client_message[strlen(client_message)] = 32
                        
}
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    }
                }
            } else {
                if ((
192 strlen(client_message)) > strlen(temp_argument)) {
                    
copy(client_message[strlen(client_message)], 191temp_argument)
                }
            }
        }

        new 
color_index = -1
        
static display_message[192]
        
remove_color_entities(client_message);

        static 
message_prefix[64]
        
get_pcvar_string(g_gameme_message_prefixmessage_prefix64)
        if (
strcmp(message_prefix"") == 0) {
            
display_message[0] = 0x01
            format
(display_message[1], 191"%s"client_message)
        } else {
            
display_message[0] = 0x04
            format
(display_message[1], 191"%s"message_prefix)
            
display_message[strlen(message_prefix) + 1] = 0x01
            format
(display_message[strlen(message_prefix) + 2], 192 - (strlen(message_prefix) + 2), " %s"client_message)
        }
        
        for (new 
0recipients_counti++) {
            new 
client str_to_num(message_recipients[i])
            if (
client 0) {
                new 
player_index get_player_index(client);
                if ((
player_index 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) {
                    
color_index player_index
                    message_begin
(MSG_ONEg_msgSayText, {0,0,0}, player_index)
                    
write_byte(color_index)
                    
write_string(display_message)
                    
message_end()
                }    
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}


public 
gameme_amx_say(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
static message[192]
    
read_args(message191)
    
remove_quotes(message)

    static 
message_prefix[64]
    
get_pcvar_string(g_gameme_message_prefixmessage_prefix64)
    if (
strcmp(message_prefix"") == 0) {
        
client_print(0print_chat"%s"message)
    } else {
        
client_print(0print_chat"%s %s"message_prefixmessage)
    }

    return 
PLUGIN_HANDLED
}


public 
gameme_amx_csay(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
static message[192]
    
read_args(message191)
    
remove_quotes(message)
    
    new 
color3[0][] = {255255255}
    new 
Float:verpos 0.3
    
    set_hudmessage
(color3[0][0], color3[0][1], color3[0][2], -1.0verpos06.06.00.50.15, -1)
    
show_hudmessage(0"%s"message)

    return 
PLUGIN_HANDLED
}


public 
gameme_amx_hint(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new argument_count read_argc()

    static 
client_id[128]
    
read_argv(1client_id127)
    new 
message_recipients[32][16];
    new 
recipients_count 0;
    if (
contain(client_id",") > -1) {
        new 
index 0
        
new length strlen(client_id
        new 
temp_length copyc(message_recipients[index], 15client_id',') + 1
        
while((temp_length length) && (++index 31)) { 
            
temp_length += copycmessage_recipients[index], 15client_id[temp_length], ',') + 1
        
}
        
recipients_count index 1;
    } else {
        if (
contain(client_id"#") > -1) {
            
copy(message_recipients[0], 15client_id[1]) 
        } else {
            
copy(message_recipients[0], 15client_id
        }
        
recipients_count 1;
    }

    if (
recipients_count 0) {

        new 
client_message[192]
        for(new 
1argument_counti++) {
            static 
temp_argument[192]
            
read_argv(1temp_argument191)
            if (
1) {
                if ((
191 strlen(client_message)) > strlen(temp_argument)) {
                    if ((
temp_argument[0] == 41) || (temp_argument[0] == 125)) {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else if ((
strlen(client_message) > 0) && (client_message[strlen(client_message)-1] != 40) && (client_message[strlen(client_message)-1] != 123) && (client_message[strlen(client_message)-1] != 58) && (client_message[strlen(client_message)-1] != 39) && (client_message[strlen(client_message)-1] != 44)) {
                        if ((
strcmp(temp_argument":") != 0) && (strcmp(temp_argument",") != 0) && (strcmp(temp_argument"'") != 0)) {
                            
client_message[strlen(client_message)] = 32
                        
}
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    } else {
                        
copy(client_message[strlen(client_message)], 191temp_argument)
                    }
                }
            } else {
                if ((
192 strlen(client_message)) > strlen(temp_argument)) {
                    
copy(client_message[strlen(client_message)], 191temp_argument)
                }
            }
        }

        for (new 
0recipients_counti++) {
            new 
client str_to_num(message_recipients[i])
            if (
client 0) {
                new 
player_index get_player_index(client);
                if ((
player_index 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) {
                    new 
color3[0][] = {2551280}
                    new 
Float:verpos 0.80
    
                    set_hudmessage
(color3[0][0], color3[0][1], color3[0][2], -1.0verpos06.06.00.50.15, -1)
                    
show_hudmessage(player_index"%s"client_message)
                }    
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}


public 
gameme_amx_msay(idlevelcid)
{
    if (!
cmd_access(idlevelcid3)) {
        return 
PLUGIN_HANDLED
    
}

    static 
delay[8]
    
read_argv(1delay7)
    
remove_quotes(delay)

    static 
name[32]
    
read_argv(2name31)
    
copy(name30name[1]) 
    new 
raw_user_id str_to_num(name)

    static 
handler_param[32]
    
read_argv(3handler_param31)
    new 
ignore_param 0
    
new need_handler 0
    
if (strcmp(handler_param"1") == 0) {
        
need_handler 1
        ignore_param 
1
    
}
    if (
strcmp(handler_param"0") == 0) {
        
need_handler 0
        ignore_param 
1
    
}
    
    static 
message[1024]
    new 
userid get_player_index(raw_user_id);

    
read_args(message1023)
    
    new 
find_pattern[] = "#"
    
new find_pos strfind(messagefind_pattern)
    new 
text_pos find_pos strlen(name) + 2
    
if (ignore_param == 1) {
        
text_pos += 3
    
}
    
    static 
menu_text[1024]
    
copy(menu_text1023message[text_pos])
    
remove_quotes(menu_text)
    
    new 
menu_display[1024]

    new 
istart 0
    
new nLen 0
    
new buffer[1024]

    for(
0strlen(menu_text); i++) {
        if (
0) {
            if ((
menu_text[i-1] == '^^') && (menu_text[i] == 'n')) {
                
buffer ""
                
copy(buffer, (start)-menu_text[start])
                
nLen += format(menu_display[nLen], (1023 nLen), "%s^n"buffer)
                
+= 1
                start 
i
            
}  
        }
    }

    if ((
userid 0) && (!is_user_bot(userid)) && (is_user_connected(userid))) {
        if (
need_handler == 0) {
            
show_menu(useriddisplay_menu_keysmenu_display15)
        } else {
            
show_menu(useriddisplay_menu_keysmenu_display15"Display Menu")
        }
    }
    
    return 
PLUGIN_HANDLED

}


public 
handle_internal_menu(idkey)
{
    new 
client id
    
if (is_user_connected(client)) {
        if (
key 9) {
            static 
player_event[192]
            new 
slot key
            slot
++
            
num_to_str(slotplayer_event192)
            
log_player_event(client"selected"player_event0)
        } else {
            new 
player_event[192] = "cancel"
            
log_player_event(client"selected"player_event0)
        }
    }
}


public 
gameme_amx_browse(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
static name[32]
    
read_argv(1name31)
    
copy(name30name[1]) 
    new 
raw_user_id str_to_num(name)
    
    static 
message[1024]
    new 
userid get_player_index(raw_user_id);
    
read_args(message1023)
    
    new 
find_pattern[] = "#"
    
new find_pos strfind(messagefind_pattern)
    
    static 
url[1024]
    
copy(url1023message[find_pos strlen(name) + 2])
    
remove_quotes(url)

    if ((
userid 0) && (!is_user_bot(userid)) && (is_user_connected(userid))) {
        
show_motd(useridurl"gameME Stats")
    }
    
    return 
PLUGIN_HANDLED
}


public 
gameme_amx_swap(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    
static client_id[32]
    
read_argv(1client_id31)
    
copy(client_id30client_id[1]) 
    new 
client str_to_num(client_id)
    
    if (
client 0) {
        new 
userid get_player_index(client);

        static 
player_team[32]
        
get_user_team(useridplayer_team31)
        
        if ((
userid 0) && (is_user_connected(userid))) {
    
            if (
strcmp(player_team"TERRORIST") == 0) {
                
cs_set_user_team(useridCS_TEAM_CT)
                
cs_reset_user_model(userid)

                if ((
ct_player_color == -1) || (userid == ct_player_color)) {
                    
ct_player_color = -1
                
} else if ((ts_player_color == -1) || (userid == ts_player_color)) {
                    
ts_player_color = -1
                
}
            } else if (
strcmp(player_team"CT") == 0) {
                
cs_set_user_team(useridCS_TEAM_T)
                
cs_reset_user_model(userid)

                if ((
ct_player_color == -1) || (userid == ct_player_color)) {
                    
ct_player_color = -1
                
} else if ((ts_player_color == -1) || (userid == ts_player_color)) {
                    
ts_player_color = -1
                
}
            }
        }
    }
    return 
PLUGIN_HANDLED
}


stock make_player_command(clientplayer_command[192]) 
{
    if (
client 0) {
        
log_player_event(client"say"player_command0)
    }
}


public 
display_menu(menuid)
{
    
menu_display(idmenu0)
}


public 
display_mainmenu(id)
{
    
display_menu(g_gameME_MainMenuid)
    return 
PLUGIN_HANDLED
}


public 
display_automenu(id)
{
    
display_menu(g_gameME_AutoMenuid)
    return 
PLUGIN_HANDLED
}


public 
display_eventsmenu(id)
{
    
display_menu(g_gameME_EventsMenuid)
    return 
PLUGIN_HANDLED
}


public 
mainmenu_handle(idmenuitem)
{
    if (
item 0) {
        return 
PLUGIN_CONTINUE
    
}
 
    static 
command[16], name[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccesscommand15name63callback)
 
    new 
choice str_to_num(command)
    switch (
choice) {
        case 

            
make_player_command(id"/rank")
        case 

            
make_player_command(id"/next")
        case 

            
make_player_command(id"/top10")
        case 

            
make_player_command(id"/clans")
        case 

            
make_player_command(id"/status")
        case 

            
make_player_command(id"/statsme")
        case 

            
display_automenu(id)
        case 

            
display_eventsmenu(id)
        case 

            
make_player_command(id"/weapons")
        case 
10 
            
make_player_command(id"/accuracy")
        case 
11 
            
make_player_command(id"/targets")
        case 
12 
            
make_player_command(id"/kills")
        case 
13 
            
make_player_command(id"/gameme_hideranking")
        case 
14 
            
make_player_command(id"/gameme_reset")
        case 
15 
            
make_player_command(id"/cheaters")
        case 
16 
            
make_player_command(id"/help")
    }
  
    return 
PLUGIN_HANDLED
}


public 
automenu_handle(idmenuitem)
{
    if (
item 0) {
        return 
PLUGIN_CONTINUE
    
}
 
    static 
command[16], name[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccesscommand15name63callback)
 
    new 
choice str_to_num(command)
    switch (
choice) {
        case 

            
make_player_command(id"/gameme_auto start rank")
        case 

            
make_player_command(id"/gameme_auto end rank")
        case 

            
make_player_command(id"/gameme_auto kill rank")
        case 

            
make_player_command(id"/gameme_auto clear")
    }
  
    return 
PLUGIN_HANDLED
}


public 
eventsmenu_handle(idmenuitem)
{
    if (
item 0) {
        return 
PLUGIN_CONTINUE
    
}
 
    static 
command[16], name[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccesscommand15name63callback)
 
    new 
choice str_to_num(command)
    switch (
choice) {
        case 

            
make_player_command(id"/gameme_display 1")
        case 

            
make_player_command(id"/gameme_display 0")
        case 

            
make_player_command(id"/gameme_chat 1")
        case 

            
make_player_command(id"/gameme_chat 0")
    }
  
    return 
PLUGIN_HANDLED
}


stock is_command_blocked(command[])
{
    if (
TrieKeyExists(g_blocked_commandscommand)) {
        return 
1
    
}
    return 
0
}



public 
gameme_block_commands(client)
{
    if (
client) {
        if (
client == 0) {
            return 
PLUGIN_CONTINUE
        
}
        
        new 
block_chat_commands get_pcvar_num(g_gameme_block_commands)
        
        static 
user_command[192]
        
read_args(user_command192)
        static 
origin_command[192]
        
        new 
start_index 0
        
new command_length strlen(user_command)
        if (
command_length 0) {
            if (
user_command[start_index] == 34)    {
                
start_index start_index 1
                
if (user_command[command_length 1] == 34)    {
                    
user_command[command_length 1] = 0
                
}
            }
            
copy(origin_command192user_command[start_index])
        }
        
        if (
command_length 0) {
            if (
block_chat_commands 0) {
                new 
command_type[32] = "say"
                
if (is_command_blocked(user_command[start_index]) > 0) {
                    if (
is_user_connected(client)) {
                        if ((
strcmp("gameme"user_command[start_index]) == 0) ||
                            (
strcmp("/gameme"user_command[start_index]) == 0) ||
                            (
strcmp("!gameme"user_command[start_index]) == 0) ||
                            (
strcmp("gameme_menu"user_command[start_index]) == 0) ||
                            (
strcmp("/gameme_menu"user_command[start_index]) == 0) ||
                            (
strcmp("!gameme_menu"user_command[start_index]) == 0)) {
                            
display_mainmenu(client)
                        }
                        
log_player_event(clientcommand_typeorigin_command0)
                    }
                    return 
PLUGIN_HANDLED
                
} else {
                    if ((
strcmp("gameme"user_command[start_index]) == 0) ||
                        (
strcmp("/gameme"user_command[start_index]) == 0) ||
                        (
strcmp("!gameme"user_command[start_index]) == 0) ||
                        (
strcmp("gameme_menu"user_command[start_index]) == 0) ||
                        (
strcmp("/gameme_menu"user_command[start_index]) == 0) ||
                        (
strcmp("!gameme_menu"user_command[start_index]) == 0)) {
                        
display_mainmenu(client)
                    }
                }
            } else {
                if (
is_user_connected(client)) {
                    if ((
strcmp("gameme"user_command[start_index]) == 0) ||
                        (
strcmp("/gameme"user_command[start_index]) == 0) ||
                        (
strcmp("!gameme"user_command[start_index]) == 0) ||
                        (
strcmp("gameme_menu"user_command[start_index]) == 0) ||
                        (
strcmp("/gameme_menu"user_command[start_index]) == 0) ||
                        (
strcmp("!gameme_menu"user_command[start_index]) == 0)) {
                        
display_mainmenu(client)
                    }
                }
                return 
PLUGIN_CONTINUE
            
}
        }
    }
 
    return 
PLUGIN_CONTINUE


Last edited by csykosoma; 12-31-2018 at 04:22.
csykosoma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-31-2018 , 20:25   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #4

If you want help you're going to need to either post both plugins (attach the file, don't copy/paste the code) or describe in more detail what is happening and what you want to happen instead.
__________________
fysiks is offline
csykosoma
Member
Join Date: Dec 2011
Old 01-01-2019 , 19:49   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #5

I'm using Smiley's pug mod here: https://forums.alliedmods.net/showthread.php?t=217539

When the pug mod is running by itself it works, but problems occur when the plugin gameme_cstrike is also running.

What happens is when the pug mod tries to show it's vote map menu, it instead shows menu select options for a menu created within gameme_cstrike. It's not showing the correct menu options that the pug mod is trying to show.



gameme_cstrike.sma
csykosoma is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-02-2019 , 03:54   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #6

Which menu from gameme exactly does it show?
__________________
klippy is offline
csykosoma
Member
Join Date: Dec 2011
Old 01-03-2019 , 01:39   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #7

Its the menu created on lines 219-235, its a 3 page menu.

PHP Code:
    g_gameME_MainMenu menu_create("gameME - Main Menu""mainmenu_handle")
    
menu_additem(g_gameME_MainMenu"Display Rank",            "1")
    
menu_additem(g_gameME_MainMenu"Next Players",            "2")
    
menu_additem(g_gameME_MainMenu"Top10 Players",           "3")
    
menu_additem(g_gameME_MainMenu"Clans Ranking",           "4")
    
menu_additem(g_gameME_MainMenu"Server Status",           "5")
    
menu_additem(g_gameME_MainMenu"Statsme",                 "6")
    
menu_additem(g_gameME_MainMenu"Auto Ranking",            "7")
    
menu_additem(g_gameME_MainMenu"Console Events",          "8")
    
menu_additem(g_gameME_MainMenu"Weapon Usage",            "9")
    
menu_additem(g_gameME_MainMenu"Weapons Accuracy",       "10")
    
menu_additem(g_gameME_MainMenu"Weapons Targets",        "11")
    
menu_additem(g_gameME_MainMenu"Player Kills",           "12")
    
menu_additem(g_gameME_MainMenu"Toggle Ranking Display""13")
    
menu_additem(g_gameME_MainMenu"Reset Statistics",       "14")
    
menu_additem(g_gameME_MainMenu"VAC Cheaterlist",        "15")
    
menu_additem(g_gameME_MainMenu"Display Help",           "16"
csykosoma is offline
thEsp
BANNED
Join Date: Aug 2017
Old 01-03-2019 , 05:30   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #8

There can be only 1 menu displayed in game at the time. But you can try using two menus with one handler or all menus in different pages. This should be working I think.
thEsp is offline
csykosoma
Member
Join Date: Dec 2011
Old 01-03-2019 , 13:57   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #9

Smileys pug use these two files to build a vote map menu, yet when that votemap menu is called its overwritten by menu options created by gameme_cstrike

PugMenus.sma

PugStocks.inc
csykosoma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-03-2019 , 21:39   Re: Running 2 plugins, the second plugin menu options overwrite the first
Reply With Quote #10

Well, what you are describing make no sense. However, there is a major issue in the files that you've provided. PugBuildMapsMenu() has a major flaw in it that prevents it from properly populating the menu pointer. The "Menu" parameter needs to be "by ref" instead of "by value" for it to work properly.

I have no idea if this is related to your issue but the map menu shouldn't work at all for sure.

Therefore, this needs fixed before you continue trying to figure out your issue just in case it is causing the issue.
__________________

Last edited by fysiks; 01-03-2019 at 21:39.
fysiks is offline
Old 01-03-2019, 23:08
csykosoma
This message has been deleted by csykosoma. Reason: im dumb
Reply


Thread Tools
Display Modes

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 16:33.


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