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

[INS] - Give Weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raghava
Junior Member
Join Date: Jun 2016
Old 08-23-2018 , 09:11   [INS] - Give Weapons
Reply With Quote #1

Hi,

In earlier sourcemod version (didn't remember V1.8 or below) my guns plugin was working fine, after few months when I tried same plugin in V1.9 is not working.

Code:
SetConVarBool(FindConVar("sv_cheats"), true, false);
FakeClientCommand(client, "give_weapon mk18");
SetConVarBool(FindConVar("sv_cheats"), false, false);
I tried same command from console even thats also not working any help
raghava is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-23-2018 , 18:33   Re: [INS] - Give Weapons
Reply With Quote #2

Quote:
Originally Posted by raghava View Post
Hi,

In earlier sourcemod version (didn't remember V1.8 or below) my guns plugin was working fine, after few months when I tried same plugin in V1.9 is not working.

Code:
SetConVarBool(FindConVar("sv_cheats"), true, false);
FakeClientCommand(client, "give_weapon mk18");
SetConVarBool(FindConVar("sv_cheats"), false, false);
I tried same command from console even thats also not working any help
Code:
new flags = GetCommandFlags("give_weapon");

SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
FakeClientCommand(client, "give_weapon mk18");
SetCommandFlags("give_weapon", flags);
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
raghava
Junior Member
Join Date: Jun 2016
Old 08-23-2018 , 21:28   Re: [INS] - Give Weapons
Reply With Quote #3

Quote:
Originally Posted by eyal282 View Post
Code:
new flags = GetCommandFlags("give_weapon");

SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
FakeClientCommand(client, "give_weapon mk18");
SetCommandFlags("give_weapon", flags);
still its not working

Code:
#include <sourcemod>

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

public void OnPluginStart()
{

  RegConsoleCmd("guns", WeaponMenu);
  LoadTranslations("common.phrases");
}

public Action:WeaponMenu(client,args)
{
    Weapons(client);
    
    return Plugin_Handled;
}
public Action:Weapons(clientId) {

	new Handle:menu = CreateMenu(WeaponMenuHandlerUS);
	SetMenuTitle(menu, "Guns Menu");
	AddMenuItem(menu, "option1", "MK18");
	AddMenuItem(menu, "option2", "M14");
	SetMenuExitButton(menu, true);
	DisplayMenu(menu, clientId, 15);
   	return Plugin_Handled;
}
public WeaponMenuHandlerUS(Handle:menu, MenuAction:action, client, itemNum)
{
	if(client > 0)
	{
		new flags = GetCommandFlags("give_weapon");
		if (action == MenuAction_Select) 
		{
        
			switch (itemNum)
			{
				case 0:
				{					
					SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
					FakeClientCommand(client, "give_weapon mk18");
					SetCommandFlags("give_weapon", flags);
					
				}
				case 1:
				{
					SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
					FakeClientCommand(client, "give_weapon m14");
					SetCommandFlags("give_weapon", flags);
					
				}				
			}
		}
	}
}

Last edited by raghava; 08-23-2018 at 21:29. Reason: added code
raghava is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-25-2018 , 15:11   Re: [INS] - Give Weapons
Reply With Quote #4

Quote:
Originally Posted by raghava View Post
still its not working

Code:
#include <sourcemod>

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

public void OnPluginStart()
{

  RegConsoleCmd("guns", WeaponMenu);
  LoadTranslations("common.phrases");
}

public Action:WeaponMenu(client,args)
{
    Weapons(client);
    
    return Plugin_Handled;
}
public Action:Weapons(clientId) {

	new Handle:menu = CreateMenu(WeaponMenuHandlerUS);
	SetMenuTitle(menu, "Guns Menu");
	AddMenuItem(menu, "option1", "MK18");
	AddMenuItem(menu, "option2", "M14");
	SetMenuExitButton(menu, true);
	DisplayMenu(menu, clientId, 15);
   	return Plugin_Handled;
}
public WeaponMenuHandlerUS(Handle:menu, MenuAction:action, client, itemNum)
{
	if(client > 0)
	{
		new flags = GetCommandFlags("give_weapon");
		if (action == MenuAction_Select) 
		{
        
			switch (itemNum)
			{
				case 0:
				{					
					SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
					FakeClientCommand(client, "give_weapon mk18");
					SetCommandFlags("give_weapon", flags);
					
				}
				case 1:
				{
					SetCommandFlags("give_weapon", flags & ~FCVAR_CHEAT);
					FakeClientCommand(client, "give_weapon m14");
					SetCommandFlags("give_weapon", flags);
					
				}				
			}
		}
	}
}
Does the menu choice work if you set sv_cheats to 1?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-25-2018 , 17:40   Re: [INS] - Give Weapons
Reply With Quote #5

GivePlayerItem
mug1wara is offline
raghava
Junior Member
Join Date: Jun 2016
Old 08-25-2018 , 21:18   Re: [INS] - Give Weapons
Reply With Quote #6

Quote:
Originally Posted by eyal282 View Post
Does the menu choice work if you set sv_cheats to 1?
Yes menu choice is working
raghava is offline
raghava
Junior Member
Join Date: Jun 2016
Old 08-29-2018 , 04:41   Re: [INS] - Give Weapons
Reply With Quote #7

When playing solo mode under console
give_weapon command is working but in cooperative n other modes its not, any help
raghava 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 12:08.


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