RemovePlayerArmedWeapon?
#1

Is there a function for that? Where it only removes the player's current armed weapon, and not the other ones?
Reply
#2

this function doesn't exist's!
you can use "SetPlayerAmmo".
Reply
#3

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
this function doesn't exist's!
you can use "SetPlayerAmmo".
OMFG What the hell.

Here is the Function.
pawn Код:
SetPlayerArmedWeapon(playerid, 0);
Reply
#4

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
OMFG What the hell.

Here is the Function.
pawn Код:
SetPlayerArmedWeapon(playerid, 0);
this will just set their weapon to fist
I dont think it will remove it from the players weapon slots.

I think the only way todo it is to
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
then
https://sampwiki.blast.hk/wiki/ResetPlayerWeapons
and then
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
Reply
#5

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
OMFG What the hell.

Here is the Function.
pawn Код:
SetPlayerArmedWeapon(playerid, 0);
That would indeed just set them to hold fists.


You can always just loop through all the weapon data, remove all the weapons, and give all the weapons excluding the desired weapon
Reply
#6

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
That would indeed just set them to hold fists.


You can always just loop through all the weapon data, remove all the weapons, and give all the weapons excluding the desired weapon
You could also just do this

pawn Код:
stock RemoveWeapon(playerid, weaponid) SetPlayerAmmo(playerid, weaponid, 0);
EDIT: If it says that function doesn't exist (read on ****** it does...but i see it on wiki) you can add this

pawn Код:
stock SetPlayerAmmo(playerid, weaponid, ammo)
{
    new weapon[13][2];
    for(new i=0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon[i][0], weapon[i][1]);
        if(weapon[i][0] == weaponid)
        {
            GivePlayerWeapon(playerid, weaponid, -(weapon[i][1]*2));
            break;
        }
    }
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
}
Reply
#7

Wow really. Thanks for the information guys
Reply
#8

Or here's another way, with

pawn Код:
RemovePlayerWeapon
pawn Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
    new plyWeapons[12];
    new plyAmmo[12];

    for(new slot = 0; slot != 12; slot++)
    {
        new wep, ammo;
        GetPlayerWeaponData(playerid, slot, wep, ammo);

        if(wep != weaponid)
        {
            GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
        }
    }

    ResetPlayerWeapons(playerid);
    for(new slot = 0; slot != 12; slot++)
    {
        GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
    }
}
Reply
#9

Thanks for all the replies I just created a stock of my own, made me get my lazy self to start the weapon saving system anyway, so thanks once again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)