Raised This Month: $51 Target: $400
 12% 

guns menu help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
imN1CK
Junior Member
Join Date: Oct 2018
Location: Brazil
Old 10-05-2018 , 12:32   guns menu help
Reply With Quote #1

Code:
stock RemoveAllWeapons(int client)
{
	int weaponslot = 0;
	int ent = -1;
	if (weaponslot == 5)
	{
		return Plugin_Handled;
	}
	while ((ent = GetPlayerWeaponSlot(client, weaponslot)) == -1 && weaponslot <= 5)
	{
		weaponslot++;
	}
	while ((ent = GetPlayerWeaponSlot(client, weaponslot)) != -1 && weaponslot <= 5)
	{
		CS_DropWeapon(client, ent, false, false);
		AcceptEntityInput(ent, "Kill");
		weaponslot++;
		ent = -1;
	}
}
when i choose weapons my knife disappear, how can i set to remove only slot1 and slot2 ?
__________________
Sourcepawn beginner
imN1CK is offline
cra88y
AlliedModders Donor
Join Date: Dec 2016
Old 10-05-2018 , 17:01   Re: guns menu help
Reply With Quote #2

This is the stock I made for it
Code:
stock void RemoveWeapons(int client, bool leavec4 = true) 
{
		int primary = GetPlayerWeaponSlot(client, 0);
		int secondary = GetPlayerWeaponSlot(client, 1);
		int knife = GetPlayerWeaponSlot(client, 2);
		if (primary > 0) 
		{
			RemovePlayerItem(client, primary);
			RemoveEdict(primary);
		}
		
		if (secondary > 0) 
		{
			RemovePlayerItem(client, secondary);
			RemoveEdict(secondary);
		}
		if (!leavec4)
		{
			int c4medi = GetPlayerWeaponSlot(client, 4);
			if (c4medi > 0) 
			{
				RemovePlayerItem(client, c4medi);
				RemoveEdict(c4medi);
			}
		}
		if (knife == -1)
		{
			GivePlayerItem(client, "weapon_knife");
		}
}
If you want to keep that one, just add
Code:
 
int knife = GetPlayerWeaponSlot(client, 2);
if (knife == -1)
{
	GivePlayerItem(client, "weapon_knife");
}
before the end and it should give the knife back.
cra88y is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode