Hello bailopan
Thanks for update..
Please refer to following post :
http://forums.alliedmods.net/showthread.php?t=155040
I think i have found a flaw in sp code : let me explain (though i prefer warn i'm not a sp file developper)
in equipement.sp you start by creating menus on plugin start :
Code:
public OnPluginStart()
{
}
you then load config datas :
Code:
public OnConfigsExecuted()
{
}
Then you load a Var saying if menus are to be shown as soon as a client dies (or respawns) and when a client joins server during a round.
Code:
public Action:DM_OnClientDeath(client)
{
if (g_SpawnTimers[client] != INVALID_HANDLE)
{
KillTimer(g_SpawnTimers[client]);
g_SpawnTimers[client] = INVALID_HANDLE;
}
g_GunMenuAvailable[client] = true;
}
public OnClientPutInServer(client)
{
g_GunMenuEnabled[client] = true;
g_GunMenuAvailable[client] = true;
g_PrimaryChoices[client] = -1;
g_SecondaryChoices[client] = -1;
}
I believe there is a bug on the g_GunMenuEnabled[client] = true; in these 2 functions.
I think there should be a if condition checking in the convars if menu is to be enabled or not
If you accept my point of view which in gungame, would suggest i do not wish to show a menu allowing weapon choosing, i would suggest following code modification to be ported in compiled smx :
Create ConVar :
Code:
"Equipment"
{
"Settings"
{
// Allow clients to say "guns" to restore their menu.
// This is disabled if the menu isn't drawn.
//
"guns_command" "no"
// Choose if by default, menus are to be displayed
//
"show_menus" "no"
}
Change dm_equipment.sp to following :
Code:
/** HUMAN CONFIGS */
new g_PrimaryList[CSSDM_MAX_WEAPONS];
new g_SecondaryList[CSSDM_MAX_WEAPONS];
new g_PrimaryCount = 0;
new g_SecondaryCount = 0;
new g_PrimaryMenu = CSSDM_GUNMENU_YES;
new g_SecondaryMenu = CSSDM_GUNMENU_YES;
new bool:g_AllowBuy = false;
new g_ArmorAmount = 100;
new bool:g_Helmets = true;
new g_Flashes = 0;
new bool:g_Smokes = false;
new bool:g_HEs = false;
new bool:g_NightVision = false;
new bool:g_DefuseKits = true;
new bool:g_AllowGunCommand = true;
new bool:g_ShowMenus = true;
new g_HealthAmount = 100;
Code:
public Action:DM_OnClientDeath(client)
{
if (g_SpawnTimers[client] != INVALID_HANDLE)
{
KillTimer(g_SpawnTimers[client]);
g_SpawnTimers[client] = INVALID_HANDLE;
}
if (!g_ShowMenus) {
g_GunMenuAvailable[client] = false;
} else {
g_GunMenuAvailable[client] = true;
}
}
public OnClientPutInServer(client)
{
if (!g_ShowMenus) {
g_GunMenuEnabled[client] = false;
} else {
g_GunMenuEnabled[client] = true;
}
if (!g_ShowMenus) {
g_GunMenuAvailable[client] = false;
} else {
g_GunMenuAvailable[client] = true;
}
g_PrimaryChoices[client] = -1;
g_SecondaryChoices[client] = -1;
}
Code:
LoadDefaults()
{
g_PrimaryMenu = CSSDM_GUNMENU_YES;
g_SecondaryMenu = CSSDM_GUNMENU_YES;
g_AllowBuy = false;
g_ArmorAmount = 100;
g_Helmets = true;
g_Flashes = 0;
g_Smokes = false;
g_HEs = false;
g_NightVision = false;
g_DefuseKits = true;
g_HealthAmount = 100;
g_AllowGunCommand = true;
g_ShowMenus = true;
}
Code:
bool:LoadConfigFile(const String:path[])
{
new Handle:kv = CreateKeyValues("Equipment");
if (!FileToKeyValues(kv, path))
{
return false;
}
decl String:value[255];
/* Load settings */
if (KvJumpToKey(kv, "Settings"))
{
g_AllowGunCommand = KvGetYesOrNo(kv, "guns_command", g_AllowGunCommand);
g_ShowMenus = KvGetYesOrNo(kv, "show_menus", g_ShowMenus);
KvGoBack(kv);
}
Thanks for your kind return on this suggestion...
Yours
Tdldp