05.01.2017, 00:47
Since there's no update with the previous function, I'll post.
- GetWeaponModelByID(weaponid); : Returns the model ID of the weaponid given as argument. Returns -1 for invalid weaponid.
- GetWeaponIDByModel(weapon_model); : Returns the weapon ID of the weapon_model given as argument. Returns -1 for invalid weapon_model.
- GetWeaponModelByID(weaponid); : Returns the model ID of the weaponid given as argument. Returns -1 for invalid weaponid.
- GetWeaponIDByModel(weapon_model); : Returns the weapon ID of the weapon_model given as argument. Returns -1 for invalid weapon_model.
pawn Код:
new
g_WeaponModels[] = {
-1,
331,
333,
334,
335,
336,
337,
338,
339,
341,
321,
322,
323,
324,
325,
326,
342,
343,
344,
-1,
-1,
-1,
346,
347,
348,
349,
350,
351,
352,
353,
355,
356,
372,
357,
358,
359,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
371
};
stock GetWeaponModelByID(weaponid) {
if(weaponid < 0 || weaponid > sizeof(g_WeaponModels))
return -1; //run time check
return g_WeaponModels[weaponid];
}
stock GetWeaponIDByModel(weapon_model) {
for(new i = 1; i< sizeof(g_WeaponModels); i++) {
if(g_WeaponModels[i] == weapon_model)
return i;
}
return -1;
}