forked from multitheftauto/mtasa-blue
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCWeaponNames.cpp
More file actions
137 lines (122 loc) · 4.36 KB
/
Copy pathCWeaponNames.cpp
File metadata and controls
137 lines (122 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CWeaponNames.cpp
* PURPOSE: GTA weapon name definitions class
*
* Multi Theft Auto is available from https://www.multitheftauto.com/
*
*****************************************************************************/
#include "StdInc.h"
#include "CWeaponNames.h"
char szWeaponNameEmpty[] = "";
struct SWeaponName
{
char szName[32];
};
struct SWeaponSlot
{
char cSlot;
};
SWeaponName WeaponNames[] = {{"Fist"},
{"Brassknuckle"},
{"Golfclub"},
{"Nightstick"},
{"Knife"},
{"Bat"},
{"Shovel"},
{"Poolstick"},
{"Katana"},
{"Chainsaw"},
{"Purple Dildo"},
{"Dildo"},
{"Vibrator"},
{"Silver Vibrator"},
{"Flower"},
{"Cane"},
{"Grenade"},
{"Teargas"},
{"Molotov"},
{"Rocket"},
{"Rocket"},
{"Freefall Bomb"},
{"Colt 45"},
{"Silenced"},
{"Deagle"},
{"Shotgun"},
{"Sawed-off"},
{"Combat Shotgun"},
{"Uzi"},
{"MP5"},
{"AK-47"},
{"M4"},
{"Tec-9"},
{"Rifle"},
{"Sniper"},
{"Rocket Launcher"},
{"Rocket Launcher HS"},
{"Flamethrower"},
{"Minigun"},
{"Satchel"},
{"Bomb"},
{"Spraycan"},
{"Fire Extinguisher"},
{"Camera"},
{"Nightvision"},
{"Infrared"},
{"Parachute"},
{"Last Weapon"},
{"Armour"},
{"Rammed"},
{"Ranover"},
{"Explosion"},
{"Driveby"},
{"Drowned"},
{"Fall"},
{"Unknown"},
{"Melee"},
{"Weapon"},
{"Flare"},
{"Tank Grenade"}};
SWeaponSlot WeaponIDs[] = {{0}, {0}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {10}, {10}, {10}, {-1}, {10}, {10}, {8}, {8}, {8}, {-1}, {-1}, {-1}, {2}, {2},
{2}, {3}, {3}, {3}, {4}, {4}, {5}, {5}, {4}, {6}, {6}, {7}, {7}, {7}, {7}, {8}, {12}, {9}, {9}, {9}, {11}, {11}, {11}, {-1}};
bool CWeaponNames::IsWeaponIDAkimbo(unsigned char ucID)
{
return (ucID == 22 || ucID == 26 || ucID == 28 || ucID == 32);
}
bool CWeaponNames::IsDriveByWeapon(unsigned char ucID)
{
return ((ucID >= 22 && ucID <= 33) || ucID == 38);
}
unsigned char CWeaponNames::GetWeaponID(const char* szName)
{
// If the specified string was empty, return 0
if (szName[0] == 0)
return 0xFF;
// Look for it in our table
for (unsigned int i = 0; i < NUMELMS(WeaponNames); i++)
{
if (stricmp(szName, WeaponNames[i].szName) == 0)
{
return i;
}
}
return 0xFF;
}
const char* CWeaponNames::GetWeaponName(unsigned char ucID)
{
if (ucID < NUMELMS(WeaponNames))
{
return WeaponNames[ucID].szName;
}
return szWeaponNameEmpty;
}
char CWeaponNames::GetSlotFromWeapon(unsigned char ucID)
{
if (ucID < NUMELMS(WeaponIDs))
{
return WeaponIDs[ucID].cSlot;
}
return -1;
}