14.05.2015, 09:17
(
Последний раз редактировалось AnnaSB; 14.05.2015 в 09:32.
Причина: New Method
)
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:
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:
Hope it helped. ^^
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
...
};
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;
}