Fixed menu toggle restrictions, disabled group menu restrictions, next commit will have it done, fixed a bunch of compiler errors :P

This commit is contained in:
Greyscale
2009-04-13 22:00:37 +02:00
parent 5652202b28
commit 34d357a2c3
5 changed files with 139 additions and 92 deletions

View File

@ -222,6 +222,8 @@ WpnRestrictQuery:RestrictRestrict(const String:weapon[], String:display[])
return Successful_Group;
}
WeaponGetDisplayName(weapon, display);
if (!WeaponsIsValidWeapon(weapon))
{
return Invalid;
@ -232,8 +234,6 @@ WpnRestrictQuery:RestrictRestrict(const String:weapon[], String:display[])
return Failed_Weapon;
}
WeaponGetDisplayName(weapon, display);
PushArrayString(gRestrictedWeapons, display);
return Successful_Weapon;
@ -286,6 +286,8 @@ WpnRestrictQuery:RestrictUnrestrict(const String:weapon[], String:display[])
return Successful_Group;
}
WeaponGetDisplayName(weapon, display);
if (!WeaponsIsValidWeapon(weapon))
{
return Invalid;
@ -296,8 +298,6 @@ WpnRestrictQuery:RestrictUnrestrict(const String:weapon[], String:display[])
return Failed_Weapon;
}
WeaponGetDisplayName(weapon, display);
new weaponindex = RestrictGetIndex(display);
if (weaponindex > -1)
{
@ -330,7 +330,7 @@ bool:RestrictIsWeaponRestricted(const String:weapon[])
}
/**
* Checks if a weapon group is restricted.
* Checks if a weapon group is completely restricted.
*
* @param weapongroup The weapon group name.
*/
@ -357,6 +357,44 @@ bool:RestrictIsGroupRestricted(const String:weapongroup[])
return false;
}
/**
* Checks if a weapon group is completely unrestricted.
*
* @param weapongroup The weapon group name.
*/
bool:RestrictIsGroupUnrestricted(const String:weapongroup[])
{
KvRewind(kvWeaponGroups);
if (KvJumpToKey(kvWeaponGroups, weapongroup))
{
decl String:groupweapon[WEAPONS_MAX_LENGTH];
do
{
KvGetSectionName(kvWeaponGroups, groupweapon, WEAPONS_MAX_LENGTH);
if (RestrictIsWeaponRestricted(groupweapon))
{
return false;
}
} while (KvGotoNextKey(kvWeaponGroups));
return true;
}
return false;
}
/**
* Checks if a weapon group is partially restricted.
*
* @param weapongroup The weapon group name.
*/
bool:RestrictIsPartialRestricted(const String:weapongroup[])
{
return (!RestrictIsGroupRestricted(weapongroup) && !RestrictIsGroupUnrestricted(weapongroup));
}
/**
* Returns the array index of the restricted weapon.
*