1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-22 04:37:13 +01:00

Merge pull request #40 from Rasikh-Qadeer/master

Update Constants.cpp
This commit is contained in:
Sandu Liviu Catalin 2019-06-02 14:02:29 +03:00 committed by GitHub
commit 23fad5a58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 5 deletions

View File

@ -142,6 +142,7 @@ void Register_Misc(HSQUIRRELVM vm)
.FmtFunc(_SC("SetAutomobileName"), &SetAutomobileName)
.FmtFunc(_SC("GetAutomobileID"), &GetAutomobileID)
.Func(_SC("IsAutomobileValid"), &IsAutomobileValid)
.Func(_SC("GetWeaponSlot"), &GetWeaponSlot)
.Func(_SC("GetWeaponName"), &GetWeaponName)
.FmtFunc(_SC("SetWeaponName"), &SetWeaponName)
.Func(_SC("GetCustomWeaponNamePoolSize"), &GetCustomWeaponNamePoolSize)

View File

@ -58,6 +58,57 @@ static inline bool IsCustomWeapon(Uint32 id)
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)
{

View File

@ -7,6 +7,11 @@
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* Retrieve the slot associated with a weapon identifier.
*/
Uint32 GetWeaponSlot(Uint32 id);
/* ------------------------------------------------------------------------------------------------
* Retrieve the name associated with a weapon identifier.
*/