mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 04:37:13 +01:00
- GetWeaponSlot
- A very useful function that sqmod can provide instead of manually being added
This commit is contained in:
parent
f02d079a8c
commit
59ced74cf8
@ -142,6 +142,7 @@ void Register_Misc(HSQUIRRELVM vm)
|
|||||||
.FmtFunc(_SC("SetAutomobileName"), &SetAutomobileName)
|
.FmtFunc(_SC("SetAutomobileName"), &SetAutomobileName)
|
||||||
.FmtFunc(_SC("GetAutomobileID"), &GetAutomobileID)
|
.FmtFunc(_SC("GetAutomobileID"), &GetAutomobileID)
|
||||||
.Func(_SC("IsAutomobileValid"), &IsAutomobileValid)
|
.Func(_SC("IsAutomobileValid"), &IsAutomobileValid)
|
||||||
|
.Func(_SC("GetWeaponSlot"), &GetWeaponSlot)
|
||||||
.Func(_SC("GetWeaponName"), &GetWeaponName)
|
.Func(_SC("GetWeaponName"), &GetWeaponName)
|
||||||
.FmtFunc(_SC("SetWeaponName"), &SetWeaponName)
|
.FmtFunc(_SC("SetWeaponName"), &SetWeaponName)
|
||||||
.Func(_SC("GetCustomWeaponNamePoolSize"), &GetCustomWeaponNamePoolSize)
|
.Func(_SC("GetCustomWeaponNamePoolSize"), &GetCustomWeaponNamePoolSize)
|
||||||
|
@ -58,6 +58,57 @@ static inline bool IsCustomWeapon(Uint32 id)
|
|||||||
return (id > 70);
|
return (id > 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Uint32 GetWeaponSlot(Uint32 id)
|
||||||
|
{
|
||||||
|
switch(id) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
return 0;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
return 1;
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
case 15:
|
||||||
|
return 2;
|
||||||
|
case 17:
|
||||||
|
case 18:
|
||||||
|
return 3;
|
||||||
|
case 19:
|
||||||
|
case 20:
|
||||||
|
case 21:
|
||||||
|
return 4;
|
||||||
|
case 22:
|
||||||
|
case 23:
|
||||||
|
case 24:
|
||||||
|
case 25:
|
||||||
|
return 5;
|
||||||
|
case 26:
|
||||||
|
case 27:
|
||||||
|
return 6;
|
||||||
|
case 28:
|
||||||
|
case 29:
|
||||||
|
return 8;
|
||||||
|
case 30:
|
||||||
|
case 31:
|
||||||
|
case 32:
|
||||||
|
case 33:
|
||||||
|
return 7;
|
||||||
|
default:
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
CCStr GetWeaponName(Uint32 id)
|
CCStr GetWeaponName(Uint32 id)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------------
|
||||||
|
* Retrieve the slot associated with a weapon identifier.
|
||||||
|
*/
|
||||||
|
Uint32 GetWeaponSlot(Uint32 id);
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the name associated with a weapon identifier.
|
* Retrieve the name associated with a weapon identifier.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user