added request at26380 (KWo)

This commit is contained in:
Borja Ferrer 2006-05-21 22:02:22 +00:00
parent 444e2caa68
commit 6af5516005

View File

@ -45,6 +45,8 @@ new g_Modified
new g_blockPos[112]
new g_saveFile[64]
new g_Restricted[] = "* This item is restricted *"
new g_szWeapRestr[27] = "0000000000000000000000000"
new g_szEquipAmmoRestr[10] = "000000000"
new g_menusNames[7][] =
{
@ -564,6 +566,32 @@ public actionMenu(id, key)
setWeapon(g_Position[id] * 7 + key, 2)
g_Modified = true
displayMenu(id, g_Position[id])
new a = g_Position[id] * 7 + key
new sz[1]
if (a < 24)
{
sz[0] = g_szWeapRestr[a + 1]
g_szWeapRestr[a + 1] = (sz[0] == '0') ? '1' : '0' // primary and secondary weapons
}
else if ((a >= 24) && (a < 31))
{
sz[0] = g_szEquipAmmoRestr[a - 24]
g_szEquipAmmoRestr[a - 24] = (sz[0] == '0') ? '1' : '0' // equipments
}
else if (a == 31)
{
sz[0] = g_szWeapRestr[25]
g_szWeapRestr[25] = (sz[0] == '0') ? '1' : '0' // shield
}
else if ((a > 31) && (a < 34))
{
sz[0] = g_szEquipAmmoRestr[a - 25]
g_szEquipAmmoRestr[a - 25] = (sz[0] == '0') ? '1' : '0' // primary and secondary ammo
}
set_cvar_string("amx_restrweapons", g_szWeapRestr)
set_cvar_string("amx_restrequipammo", g_szEquipAmmoRestr)
}
}
@ -666,6 +694,9 @@ loadSettings(filename[])
new text[16]
new a, pos = 0
format(g_szEquipAmmoRestr, 9, "000000000")
format(g_szWeapRestr, 26, "00000000000000000000000000")
while (read_file(filename, pos++, text, 15, a))
{
if (text[0] == ';' || !a)
@ -674,8 +705,16 @@ loadSettings(filename[])
parse(text, text, 15)
if ((a = findAliasId(text)) != -1)
{
setWeapon(a, 1)
if (a < 24) g_szWeapRestr[a + 1] = '1' // primary and secondary weapons
else if ((a >= 24) && (a < 31)) g_szEquipAmmoRestr[a - 24] = '1' // equipments
else if (a == 31) g_szWeapRestr[25] = '1' // shield
else if ((a > 31) && (a < 34)) g_szEquipAmmoRestr[a - 25] = '1' // primary and secondary ammo
}
}
set_cvar_string("amx_restrweapons", g_szWeapRestr)
set_cvar_string("amx_restrequipammo", g_szEquipAmmoRestr)
return 1
}
@ -787,6 +826,9 @@ public plugin_init()
register_menucmd(-34, 511, "menuItem")
register_concmd("amx_restrict", "cmdRest", ADMIN_CFG, "- displays help for weapons restriction")
register_cvar("amx_restrweapons", "00000000000000000000000000")
register_cvar("amx_restrequipammo", "000000000")
new configsDir[64];
get_configsdir(configsDir, 63);
#if defined MAPSETTINGS