[Include] Multi-Weapon - Able to switch to every weapon received

Started by SA:MP, May 10, 2023, 02:54 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

SA:MP

[Include] Multi-Weapon - Able to switch to every weapon received

Description

Allows players to switch through weapons with the same weapon slot instead of loosing their previous weapon.

Lets say you are holding a Deagle with 25 ammo, normally when you get a silencer with 25 ammo, you

would lose the deagle and than have a silencer with 50 ammo.

With this include you will get a silencer with 25 ammo instead and have the ability to switch to the deagle by pressing ALT, receiving the ammo specifically for that weapon.

This system works for every weapon.



Video

Having some trouble uploading an attached file, will try again tomorrow.



How to use

Simply include the file in your gamemode and you're done.

No changes are required within the gamemode for this to work.

Although, if you are using 'GetPlayerWeaponData' you will have to use it differently now.



Before:


Код:

	new weapons[12][2];
for (new i = 0; i <= 12; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}

Now:




Код:

	new weapons[47][2];
for (new i = 1; i <= 47; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}

This function now returns every weapon instead of only the weapon slot in use.



How to switch weapon (Note: Switching weapons through the weapon slot of your equipped weapon)

By default you can switch weapons with the 'ALT' key.

Incase you feel like changing this:

-> open 'multi_weapon.inc'

-> go to line '9' (#define MULTI_WEAPON_SWITCH_KEY KEY_WALK)

-> change 'KEY_WALK' to any SAMP KEY you like.

(info about keys: https://sampwiki.blast.hk/wiki/Keys)



Dependencies

y_hooks



Download

git: multi_weapon.inc

Source: [Include] Multi-Weapon - Able to switch to every weapon received