Raised This Month: $32 Target: $400
 8% 

I want to modify the weapon remove plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NewWorld_
Junior Member
Join Date: Sep 2020
Old 09-11-2020 , 04:26   I want to modify the weapon remove plugin.
Reply With Quote #1

The code of the plugin I use is below.

PHP Code:
public Action:Event_Spawn(Handle:event, const String:name[], bool:broadcast)
{
    new 
Client GetClientOfUserId(GetEventInt(event"userid"));
        
    new 
WeaponIndex;
    for (new 
0<= 4x++)
    {
        if (
!= CS_SLOT_KNIFE && (WeaponIndex GetPlayerWeaponSlot(Clientx)) != -1)
        {
            
RemovePlayerItem(ClientWeaponIndex);
            
RemoveEdict(WeaponIndex);
        }
    }
    
    if (
GetClientTeam(Client) == TEAM_OFFICER)
        
GivePlayerItem(Client"item_assaultsuit");
    
    
SetEntityRenderColor(Client255255255255);
    
FakeClientCommand(Client"use weapon_knife");
    
Revolt[Client] = false;


Players should only be equipped with knives at the start of the round, i.e. the weapons of the previous round should be deleted except knives.



But it does not disappear as shown in the picture. I would like to solve the problem. Any help would be appreciated
Attached Thumbnails
Click image for larger version

Name:	Screenshot_1.png
Views:	68
Size:	54.9 KB
ID:	183642  
__________________
WE ALWAYS RESEARCH TO MAKE THE FUN SERVER
NewWorld_ is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 09-11-2020 , 06:51   Re: I want to modify the weapon remove plugin.
Reply With Quote #2

Quote:
Originally Posted by NewWorld_ View Post
The code of the plugin I use is below.

PHP Code:
public Action:Event_Spawn(Handle:event, const String:name[], bool:broadcast)
{
    new 
Client GetClientOfUserId(GetEventInt(event"userid"));
        
    new 
WeaponIndex;
    for (new 
0<= 4x++)
    {
        if (
!= CS_SLOT_KNIFE && (WeaponIndex GetPlayerWeaponSlot(Clientx)) != -1)
        {
            
RemovePlayerItem(ClientWeaponIndex);
            
RemoveEdict(WeaponIndex);
        }
    }
    
    if (
GetClientTeam(Client) == TEAM_OFFICER)
        
GivePlayerItem(Client"item_assaultsuit");
    
    
SetEntityRenderColor(Client255255255255);
    
FakeClientCommand(Client"use weapon_knife");
    
Revolt[Client] = false;


Players should only be equipped with knives at the start of the round, i.e. the weapons of the previous round should be deleted except knives.



But it does not disappear as shown in the picture. I would like to solve the problem. Any help would be appreciated
Use smlib include:
PHP Code:
Client_RemoveAllWeapons(Client ,"weapon_knife",true); 
__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
NewWorld_
Junior Member
Join Date: Sep 2020
Old 09-11-2020 , 09:09   Re: I want to modify the weapon remove plugin.
Reply With Quote #3

Quote:
Originally Posted by SSheriFF View Post
Use smlib include:
PHP Code:
Client_RemoveAllWeapons(Client ,"weapon_knife",true); 
Thank you. I solved it,

but do you know how to easily get the Offset value?

PHP Code:
"Offsets"
        
{
            
"Clip"
            
{
                
"windows" "351"
                "linux" "359"
            
}
            
"Reserve"
            
{
                
"windows" "355"
                "linux" "363"
            
}
        } 
30/90 ammo and magazine config plugins, or is there a config plugin for each weapon?
__________________
WE ALWAYS RESEARCH TO MAKE THE FUN SERVER
NewWorld_ is offline
puma133
Member
Join Date: Jun 2009
Old 12-02-2020 , 11:26   Re: I want to modify the weapon remove plugin.
Reply With Quote #4

Your code doesn't work.
I did through GivePlayerItem and work, but doesn't want to issue modifications
Who help ?

Code:
#include <sourcemod>
#include <sdktools>
#pragma newdecls required

char CurrentGameMode[30];

public Plugin myinfo =
{
	name = "[INS] Guns Menu",
	author = "",
	description = "Guns Menu",
	version = "0.4",
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("guns", WeaponMenu);
	LoadTranslations("common.phrases");
}

public void OnConfigsExecuted()
{
	ConVar mp_gamemode = FindConVar("mp_gamemode");
	if (mp_gamemode != null)
	{
		mp_gamemode.GetString(CurrentGameMode, sizeof(CurrentGameMode));
		delete mp_gamemode;
		return;
	}
	CurrentGameMode[0] = '\0';
}

public Action WeaponMenu(int client, int args)
{
	if (IsClientInGame(client))
	{
		if (!IsFakeClient(client))
		{
			Weapons(client);
		}
	}
	return Plugin_Handled;
}

public Action Weapons(int client)
{
	if (client > 0)
	{
		Menu menu = new Menu(AdminWeaponMenuHandlerUS);
		menu.SetTitle("Guns Menu");
		menu.AddItem("1", "AT4");
		menu.AddItem("2", "RPG");
		menu.AddItem("3", "MK18");
		menu.ExitButton = false;
		menu.Display(client, 15);
	}
	return Plugin_Handled;
}

public int AdminWeaponMenuHandlerUS(Menu menu, MenuAction action, int client, int itemNum)
{
	switch (action)
	{
		case MenuAction_End:
		{
			delete menu;
		}
		case MenuAction_Select:
		{
			char info[32];
			menu.GetItem(itemNum, info, sizeof(info));
			if (strcmp(info, "1") == 0)
			{
				GivePlayerItem(client,  "weapon_at4");
			}
			if (strcmp(info, "2") == 0)
			{
				GivePlayerItem(client, "weapon_rpg7");
			}
			if (strcmp(info, "3") == 0)
			{
				GivePlayerItem(client, "weapon_mk18");
				GivePlayerItem(client, "upgrade_optic_aimpoint"); //modifications !!!
			}
			
			GivePlayerItem(client, "ammo 5");
		}
	}
}

stock void HxFakeCHEAT(int &client, char[] sCmd, char[] sArg)
{
	int iFlags = GetCommandFlags(sCmd);
	SetCommandFlags(sCmd, iFlags & ~FCVAR_CHEAT);
	FakeClientCommand(client, "%s %s", sCmd, sArg);
	SetCommandFlags(sCmd, iFlags);
}
puma133 is offline
Reply


Thread Tools
Display Modes

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 21:08.


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