|
3 | 3 | #endif |
4 | 4 | #define _mainweapon_included |
5 | 5 |
|
| 6 | +// WEAPON AMOUNT LIMIT |
| 7 | +/** |
| 8 | + * -DESCRIPTION: |
| 9 | + * -Defines the weapon amount limit. |
| 10 | + */ |
| 11 | +#define MAX_WEAPONS 47 |
| 12 | + |
6 | 13 | // INVALID WEAPON |
7 | 14 | /** |
8 | 15 | * -DESCRIPTION: |
9 | 16 | * -Defines an invalid weapon ID. |
10 | 17 | */ |
11 | 18 | #define INVALID_WEAPON_ID -1 |
12 | 19 |
|
| 20 | +// WEAPON ID |
| 21 | +/** |
| 22 | + * -DESCRIPTION: |
| 23 | + * -Defines some missing weapon ID constants. |
| 24 | + */ |
| 25 | +#define WEAPON_FISTS 0 |
| 26 | +#define WEAPON_NIGHTVISION 44 |
| 27 | +#define WEAPON_INFRARED 45 |
| 28 | + |
13 | 29 | // NAMES |
14 | 30 | /** |
15 | 31 | * -DESCRIPTION: |
@@ -47,7 +63,7 @@ static const MainWeapon_WeaponNames[][] = { |
47 | 63 | */ |
48 | 64 | // native bool:IsValidWeapon(weaponid); // Fake native |
49 | 65 | stock bool:IsValidWeapon(weaponid) { |
50 | | - if((weaponid >= 0 && weaponid <= 18) || (weaponid >= 22 && weaponid <= 46)) { |
| 66 | + if((weaponid >= 0 && weaponid <= 18) || (weaponid >= 22 && weaponid < MAX_WEAPONS)) { |
51 | 67 | return true; |
52 | 68 | } |
53 | 69 | return false; |
@@ -89,12 +105,207 @@ static const MainWeapon_WeaponModels[] = { |
89 | 105 | */ |
90 | 106 | // native GetWeaponModel(weaponid); // Fake native |
91 | 107 | stock GetWeaponModel(weaponid) { |
92 | | - if(weaponid >= 0 && weaponid <= 46) { |
| 108 | + if(weaponid >= 0 && weaponid < MAX_WEAPONS) { |
93 | 109 | return MainWeapon_WeaponModels[weaponid]; |
94 | 110 | } |
95 | 111 | return INVALID_MODEL_ID; |
96 | 112 | } |
97 | 113 |
|
| 114 | +// IS WEAPON SPRINT ALLOWED |
| 115 | +/** |
| 116 | + * -DESCRIPTION: |
| 117 | + * -Get whether a weapon ID allows sprinting. |
| 118 | + * -PARAMETERS: |
| 119 | + * -weaponid: The ID of the weapon to get whether it allows sprinting. |
| 120 | + * -RETURN VALUES: |
| 121 | + * -true: The function executed successfully. The weapon ID allows sprinting. |
| 122 | + * -false: The function executed successfully. The weapon ID does not allow sprinting. |
| 123 | + */ |
| 124 | +// native bool:IsWeaponSprintAllowed(weaponid); // Fake native |
| 125 | +stock bool:IsWeaponSprintAllowed(weaponid) { |
| 126 | + switch(weaponid) { |
| 127 | + case WEAPON_FISTS: return true; |
| 128 | + case WEAPON_BRASSKNUCKLE: return true; |
| 129 | + case WEAPON_GOLFCLUB: return true; |
| 130 | + case WEAPON_NITESTICK: return true; |
| 131 | + case WEAPON_KNIFE: return true; |
| 132 | + case WEAPON_BAT: return false; |
| 133 | + case WEAPON_SHOVEL: return false; |
| 134 | + case WEAPON_POOLSTICK: return false; |
| 135 | + case WEAPON_KATANA: return true; |
| 136 | + case WEAPON_CHAINSAW: return false; |
| 137 | + case WEAPON_DILDO: return true; |
| 138 | + case WEAPON_DILDO2: return true; |
| 139 | + case WEAPON_VIBRATOR: return true; |
| 140 | + case WEAPON_VIBRATOR2: return true; |
| 141 | + case WEAPON_FLOWER: return true; |
| 142 | + case WEAPON_CANE: return true; |
| 143 | + case WEAPON_GRENADE: return true; |
| 144 | + case WEAPON_TEARGAS: return true; |
| 145 | + case WEAPON_MOLTOV: return true; |
| 146 | + case 19: return false; |
| 147 | + case 20: return false; |
| 148 | + case 21: return false; |
| 149 | + case WEAPON_COLT45: return true; |
| 150 | + case WEAPON_SILENCED: return true; |
| 151 | + case WEAPON_DEAGLE: return true; |
| 152 | + case WEAPON_SHOTGUN: return false; |
| 153 | + case WEAPON_SAWEDOFF: return true; |
| 154 | + case WEAPON_SHOTGSPA: return false; |
| 155 | + case WEAPON_UZI: return true; |
| 156 | + case WEAPON_MP5: return true; |
| 157 | + case WEAPON_AK47: return false; |
| 158 | + case WEAPON_M4: return false; |
| 159 | + case WEAPON_TEC9: return true; |
| 160 | + case WEAPON_RIFLE: return false; |
| 161 | + case WEAPON_SNIPER: return false; |
| 162 | + case WEAPON_ROCKETLAUNCHER: return false; |
| 163 | + case WEAPON_HEATSEEKER: return false; |
| 164 | + case WEAPON_FLAMETHROWER: return false; |
| 165 | + case WEAPON_MINIGUN: return false; |
| 166 | + case WEAPON_SATCHEL: return true; |
| 167 | + case WEAPON_BOMB: return true; |
| 168 | + case WEAPON_SPRAYCAN: return true; |
| 169 | + case WEAPON_FIREEXTINGUISHER: return true; |
| 170 | + case WEAPON_CAMERA: return true; |
| 171 | + case WEAPON_NIGHTVISION: return true; |
| 172 | + case WEAPON_INFRARED: return true; |
| 173 | + case WEAPON_PARACHUTE: return true; |
| 174 | + } |
| 175 | + return false; |
| 176 | +} |
| 177 | + |
| 178 | +// IS WEAPON CROUCH ALLOWED |
| 179 | +/** |
| 180 | + * -DESCRIPTION: |
| 181 | + * -Get whether a weapon ID allows crouching. |
| 182 | + * -PARAMETERS: |
| 183 | + * -weaponid: The ID of the weapon to get whether it allows crouching. |
| 184 | + * -RETURN VALUES: |
| 185 | + * -true: The function executed successfully. The weapon ID allows crouching. |
| 186 | + * -false: The function executed successfully. The weapon ID does not allow crouching. |
| 187 | + */ |
| 188 | +// native bool:IsWeaponCrouchAllowed(weaponid); // Fake native |
| 189 | +stock bool:IsWeaponCrouchAllowed(weaponid) { |
| 190 | + switch(weaponid) { |
| 191 | + case WEAPON_FISTS: return true; |
| 192 | + case WEAPON_BRASSKNUCKLE: return true; |
| 193 | + case WEAPON_GOLFCLUB: return true; |
| 194 | + case WEAPON_NITESTICK: return true; |
| 195 | + case WEAPON_KNIFE: return true; |
| 196 | + case WEAPON_BAT: return true; |
| 197 | + case WEAPON_SHOVEL: return true; |
| 198 | + case WEAPON_POOLSTICK: return true; |
| 199 | + case WEAPON_KATANA: return true; |
| 200 | + case WEAPON_CHAINSAW: return true; |
| 201 | + case WEAPON_DILDO: return true; |
| 202 | + case WEAPON_DILDO2: return true; |
| 203 | + case WEAPON_VIBRATOR: return true; |
| 204 | + case WEAPON_VIBRATOR2: return true; |
| 205 | + case WEAPON_FLOWER: return true; |
| 206 | + case WEAPON_CANE: return true; |
| 207 | + case WEAPON_GRENADE: return false; |
| 208 | + case WEAPON_TEARGAS: return false; |
| 209 | + case WEAPON_MOLTOV: return false; |
| 210 | + case 19: return false; |
| 211 | + case 20: return false; |
| 212 | + case 21: return false; |
| 213 | + case WEAPON_COLT45: return true; |
| 214 | + case WEAPON_SILENCED: return true; |
| 215 | + case WEAPON_DEAGLE: return true; |
| 216 | + case WEAPON_SHOTGUN: return true; |
| 217 | + case WEAPON_SAWEDOFF: return true; |
| 218 | + case WEAPON_SHOTGSPA: return true; |
| 219 | + case WEAPON_UZI: return true; |
| 220 | + case WEAPON_MP5: return true; |
| 221 | + case WEAPON_AK47: return true; |
| 222 | + case WEAPON_M4: return true; |
| 223 | + case WEAPON_TEC9: return true; |
| 224 | + case WEAPON_RIFLE: return true; |
| 225 | + case WEAPON_SNIPER: return true; |
| 226 | + case WEAPON_ROCKETLAUNCHER: return false; |
| 227 | + case WEAPON_HEATSEEKER: return false; |
| 228 | + case WEAPON_FLAMETHROWER: return false; |
| 229 | + case WEAPON_MINIGUN: return false; |
| 230 | + case WEAPON_SATCHEL: return false; |
| 231 | + case WEAPON_BOMB: return true; |
| 232 | + case WEAPON_SPRAYCAN: return true; |
| 233 | + case WEAPON_FIREEXTINGUISHER: return false; |
| 234 | + case WEAPON_CAMERA: return false; |
| 235 | + case WEAPON_NIGHTVISION: return true; |
| 236 | + case WEAPON_INFRARED: return true; |
| 237 | + case WEAPON_PARACHUTE: return true; |
| 238 | + } |
| 239 | + return false; |
| 240 | +} |
| 241 | + |
| 242 | +// GET WEAPON DAMAGE |
| 243 | +/** |
| 244 | + * -DESCRIPTION: |
| 245 | + * -Get a weapon's damage. |
| 246 | + * -PARAMETERS: |
| 247 | + * -weaponid: The ID of the weapon to get the damage of. |
| 248 | + * -RETURN VALUES: |
| 249 | + * -valid damage: The function executed successfully. |
| 250 | + * -0.0: |
| 251 | + * -The function executed successfully. The weaponid doesn't have a non-zero damage. |
| 252 | + * -The function failed to execute. An invalid weaponid was given. |
| 253 | + */ |
| 254 | +// native Float:GetWeaponDamage(weaponid); // Fake native |
| 255 | +stock Float:GetWeaponDamage(weaponid) { |
| 256 | + new Float:damage = 0.0; |
| 257 | + switch(weaponid) { |
| 258 | + case WEAPON_FISTS: damage = 5.0; |
| 259 | + case WEAPON_BRASSKNUCKLE: damage = 5.0; |
| 260 | + case WEAPON_GOLFCLUB: damage = 5.0; |
| 261 | + case WEAPON_NITESTICK: damage = 5.0; |
| 262 | + case WEAPON_KNIFE: damage = 5.0; |
| 263 | + case WEAPON_BAT: damage = 5.0; |
| 264 | + case WEAPON_SHOVEL: damage = 5.0; |
| 265 | + case WEAPON_POOLSTICK: damage = 5.0; |
| 266 | + case WEAPON_KATANA: damage = 5.0; |
| 267 | + case WEAPON_CHAINSAW: damage = 5.0; |
| 268 | + case WEAPON_DILDO: damage = 5.0; |
| 269 | + case WEAPON_DILDO2: damage = 5.0; |
| 270 | + case WEAPON_VIBRATOR: damage = 5.0; |
| 271 | + case WEAPON_VIBRATOR2: damage = 5.0; |
| 272 | + case WEAPON_FLOWER: damage = 5.0; |
| 273 | + case WEAPON_CANE: damage = 5.0; |
| 274 | + case WEAPON_GRENADE: damage = 5.0; |
| 275 | + case WEAPON_TEARGAS: damage = 5.0; |
| 276 | + case WEAPON_MOLTOV: damage = 5.0; |
| 277 | + case 19: damage = 0.0; |
| 278 | + case 20: damage = 0.0; |
| 279 | + case 21: damage = 0.0; |
| 280 | + case WEAPON_COLT45: damage = 8.25; |
| 281 | + case WEAPON_SILENCED: damage = 13.2; |
| 282 | + case WEAPON_DEAGLE: damage = 46.2; |
| 283 | + case WEAPON_SHOTGUN: damage = 30.0; |
| 284 | + case WEAPON_SAWEDOFF: damage = 30.0; |
| 285 | + case WEAPON_SHOTGSPA: damage = 30.0; |
| 286 | + case WEAPON_UZI: damage = 6.60; |
| 287 | + case WEAPON_MP5: damage = 8.25; |
| 288 | + case WEAPON_AK47: damage = 9.90; |
| 289 | + case WEAPON_M4: damage = 9.90; |
| 290 | + case WEAPON_TEC9: damage = 6.60; |
| 291 | + case WEAPON_RIFLE: damage = 24.8; |
| 292 | + case WEAPON_SNIPER: damage = 41.3; |
| 293 | + case WEAPON_ROCKETLAUNCHER: damage = 5.0; |
| 294 | + case WEAPON_HEATSEEKER: damage = 5.0; |
| 295 | + case WEAPON_FLAMETHROWER: damage = 5.0; |
| 296 | + case WEAPON_MINIGUN: damage = 46.2; |
| 297 | + case WEAPON_SATCHEL: damage = 5.0; |
| 298 | + case WEAPON_BOMB: damage = 5.0; |
| 299 | + case WEAPON_SPRAYCAN: damage = 5.0; |
| 300 | + case WEAPON_FIREEXTINGUISHER: damage = 5.0; |
| 301 | + case WEAPON_CAMERA: damage = 0.0; |
| 302 | + case WEAPON_NIGHTVISION: damage = 0.0; |
| 303 | + case WEAPON_INFRARED: damage = 0.0; |
| 304 | + case WEAPON_PARACHUTE: damage = 0.0; |
| 305 | + } |
| 306 | + return damage; |
| 307 | +} |
| 308 | + |
98 | 309 | // GET WEAPON VEHICLE DAMAGE |
99 | 310 | /** |
100 | 311 | * -DESCRIPTION: |
@@ -166,7 +377,7 @@ stock bool:IsMeleeWeapon(weaponid) { |
166 | 377 | */ |
167 | 378 | // native GetWeaponName(weaponid, name[], len); // Fake native |
168 | 379 | stock MainWeapon_GetWeaponName(weaponid, name[], len) { |
169 | | - if(weaponid >= 0 && weaponid <= 46) { |
| 380 | + if(weaponid >= 0 && weaponid < MAX_WEAPONS) { |
170 | 381 | // NAMES |
171 | 382 | return strmid(name, MainWeapon_WeaponNames[weaponid], 0, len, len); |
172 | 383 | } |
|
0 commit comments