Weapon Skill System [ REP + ]
#5

Create a global array, like WepSkillTrans[],
Inside it, in each index, put that index's weapon's skill id, and those which don't accept skills, put -1.
For example:
PHP код:
new WepSkillTrans[45] = {
-
1// 0: Fist - No Skill
-1// 1: Knuckles - No Skill
...
8// 30: AK47 - AK47 Skill
9// 31: M4 - M4 Skill
...
}; 
and to get the skill id, you just put the weapon ID as the index,
For example you want to get the Shotgun's skill id, just write WepSkillTrans[WEAPON_SHOTGUN] and it will return you WEAPONSKILL_SHOTGUN (it's 3).

Edit: Just letting you know, there is a non-memorizing method too, as weapon IDs starting from the 9mm Pistol are mostly equivalent to weponid - 22, but it needs some IFs and it's a bit complicated:
PHP код:
stock GetWeaponSkillID(weaponid)
{
if (
weaponid 22 || weaponid 34) return -1;
if (
weaponid == 32) return 6;
if (
weaponid 32) return 10;
return 
weaponid 22;

Hope it helped. ^^
Reply


Messages In This Thread
Weapon Skill System [ REP + ] - by _GHT_MarK445 - 13.05.2015, 20:25
Re: Weapon Skill System [ REP + ] - by _GHT_MarK445 - 14.05.2015, 08:28
Re: Weapon Skill System [ REP + ] - by Youssef221 - 14.05.2015, 08:51
Re: Weapon Skill System [ REP + ] - by bigtigerbeee - 14.05.2015, 09:01
Re: Weapon Skill System [ REP + ] - by AnnaSB - 14.05.2015, 09:17
Re: Weapon Skill System [ REP + ] - by Gammix - 14.05.2015, 09:21
Re: Weapon Skill System [ REP + ] - by SoFahim - 14.05.2015, 13:10

Forum Jump:


Users browsing this thread: 2 Guest(s)