hold one gun only no switching weapons
#1

i tried doing research on if a player could only hold one gun and im not talking about setplayerskilllevel i mean hold only one gun or maye

add it so that i could have a side arm

im trying to make the game more realistic theres no way your running down the street with an ak sniper rifle shotgun rpg pistol and a uzi with a ninja swork in your back pocket
Reply
#2

What you mean You want the other players be able to have only 1 weapon??
Reply
#3

well if you could carry 2 guns 1 full size weapon and a hangun
a melee would count as a full size weapon

so you could only carry a pistol and another weapon
Reply
#4

Something like this:
Код:
new
    weapon,
    ammo
;
new weapon, ammo;
for(new i = 3; i < 7; i ++) // Get's weapondata of slots 3-4-5-6-7
{
    GetPlayerWeaponData(playerid, i, weapon, ammo);
    if(weapon) SetPlayerAmmo(playerid, weapon, 0);
}
GivePlayerWeapon(playerid, 31, 500);
https://sampwiki.blast.hk/wiki/SetPlayerAmmo
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Reply
#5

One of my older scripts does this. This should work:

pawn Код:
new lastWeapon[MAX_PLAYERS char];

public OnPlayerUpdate(playerid)
{
    new w = GetPlayerWeapon(playerid);

    if(w != lastWeapon{playerid})
    {
        // You probably don't need this line.. Not sure why I left it, but there may be a reason.
        if(lastWeapon{playerid} == 0) return lastWeapon{playerid} = GetPlayerWeapon(playerid);

    SetPlayerArmedWeapon(playerid, lastWeapon{playerid});
    }

    lastWeapon{playerid} = w;

    return 1;
}
EDIT: Added char variables.

Sauce: https://sampforum.blast.hk/showthread.php?tid=516386
Reply
#6

that thread is the only one i seen and it seemed a little complicated im looking for something a little more simple like the codes yall posted


i tried
Код:
new lastWeapon[MAX_PLAYERS char];

public OnPlayerUpdate(playerid)
{
    new w = GetPlayerWeapon(playerid);

    if(w != lastWeapon{playerid})
    {
    	// You probably don't need this line.. Not sure why I left it, but there may be a reason.
    	if(lastWeapon{playerid} == 0) return lastWeapon{playerid} = GetPlayerWeapon(playerid);

	SetPlayerArmedWeapon(playerid, lastWeapon{playerid});
    }

    lastWeapon{playerid} = w;

    return 1;
}
just bugged my weapons back and forth
Reply
#7

bump do you think its possible without bug to only hold 2 slots?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)