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

Fun mod command error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Heypio
Junior Member
Join Date: Nov 2017
Old 05-15-2018 , 16:05   Fun mod command error
Reply With Quote #1

plugin enabled command not working.Where is the problem ?

Note: plugin enable, writing not say.

I apologize for my english


Commands
Code:
	
RegAdminCmd("sm_funmodenable", Command_PluginEnable, ADMFLAG_KICK);
RegAdminCmd("sm_funmoddisable", Command_PluginDisable, ADMFLAG_KICK);
Code:
public Action:Command_PluginEnable(client, args) {
	
	new String:arg[3];
	GetCmdArg(1, arg, sizeof(arg));
	int EnableNumber = StringToInt(arg);

	if(EnableNumber == 1) {
		g_EnablePluginu = true;
		PrintToChatAll("Plugin enabled!");  
	   }	
}

public Action:Command_PluginDisable(client, args) {
	new String:arg[3];
	GetCmdArg(1, arg, sizeof(arg));
	int EnableNumber = StringToInt(arg);
	
    if(EnableNumber == 0) {
		g_EnablePluginu = false;
		PrintToChatAll("Plugin disabled!");	
	   }	   
}

Last edited by Heypio; 05-15-2018 at 16:13.
Heypio is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 05-16-2018 , 16:02   Re: Fun mod command error
Reply With Quote #2

If you use 2 different commands to enable and disable plugin you dont need args
How you use it?
sm_funmodenable 1

Last edited by Indarello; 05-16-2018 at 16:09.
Indarello is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 05-16-2018 , 18:18   Re: Fun mod command error
Reply With Quote #3

Code:
RegAdminCmd("sm_funmode", Command_FunMode, ADMFLAG_KICK);
Code:
public Action Command_FunMode(int client, int args) {
	if (args < 1)
	{
		PrintToChat(client, "Usage: sm_funmode <1/0>.");
		return Plugin_Handled;
	}
	char sArg[3];
	GetCmdArg(1, sArg, sizeof(sArg));
	g_EnablePluginu = StringToInt(sArg) == 1;
	
	PrintToChatAll("Plugin %s!", g_EnablePluginu ? "enabled" : "disabled");
	return Plugin_Handled;
}
Enjoy.
__________________
Taking private requests


Last edited by KlausLaw; 05-16-2018 at 18:20.
KlausLaw 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 16:28.


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