[>>REALY<< LITTLE HELP] How to make a switch off system for a command
#1

Hi, i'm new on pawno scripting so I want to know if this is going to work.
I want to make a /switchoff system, so when I /switchoffhelp, it will desactivate the /help command, will this work? :

http://pastebin.com/m42419354

I just want to know if it will work, and if it wont work, can you tell me how to do it? Thank you
P.S = I did it, I'm not asking you to do it for me
Reply
#2

I changed the link.. I forgot something...
Reply
#3

Just make it so if a value is eg 1, it'll return 0; before strcmp(cmdtext, "/help")
Reply
#4

On top..

Код:
new helpoff;
Then on /switchoffhelp

Код:
helpoff = 1;
And then, at /help:

Код:
if(helpoff == 1)
I hope I remembered that correctly.

EDIT: Sorry, didnt see the pastebin link, do it this way:

Код:
new HelpActivated = 1;
//forward not needed.

// Command to switch off
if(strcmp("/switchoffhelp", cmd, true) == 0) || if(Logged[playerid] == 1) //You forgot the || here
{
HelpActivated == 0); // 0 = no, 1 = yes
}
return 1;

// Help command

if(strcmp(cmd,"/help",true) == 0)
{
if(HelpActivated == 1) // == instead of =
{
SendClientMessage(playerid,COLOR_WHITE,"Help text...");
}
else
}
SendClientMessage(playerid,COLOR_WHITE,"The help command has been desactivated");
}
return 1;
Reply
#5

Quote:
Originally Posted by Mo3
On top..

Код:
new helpoff;
Then on /switchoffhelp

Код:
helpoff = 1;
And then, at /help:

Код:
if(helpoff == 1)
I hope I remembered that correctly.

EDIT: Sorry, didnt see the pastebin link, do it this way:

Код:
new HelpActivated = 1;
//forward not needed.

// Command to switch off
if(strcmp("/switchoffhelp", cmd, true) == 0) || if(Logged[playerid] == 1) //You forgot the || here
{
HelpActivated == 0); // 0 = no, 1 = yes
}
return 1;

// Help command

if(strcmp(cmd,"/help",true) == 0)
{
if(HelpActivated == 1) // == instead of =
{
SendClientMessage(playerid,COLOR_WHITE,"Help text...");
}
else
}
SendClientMessage(playerid,COLOR_WHITE,"The help command has been desactivated");
}
return 1;
It doesnt work :S
Reply
#6

Are you sure that works? I dont think so, you will have a lot of errors with that, I make a better one:
Код:
// The variable
new HelpActivated = 1;

// The commands
if(strcmp(cmd, "/helpoff", true) == 0)
{
if(Logged[playerid] == 1)
{
HelpActivated = 0;
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command.");
}
return 1;
}
if(strcmp(cmd, "/help", true) == 0)
{
if(HelpActivated == 1)
{
SendClientMessage(playerid,COLOR_WHITE,"Help text...");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"This command has been desactivated");
}
return 1;
}
Tell me if it works / works better
Reply
#7

Quote:
Originally Posted by JonyAvati
Are you sure that works? I dont think so, you will have a lot of errors with that, I make a better one:
Код:
// The variable
new HelpActivated = 1;

// The commands
if(strcmp(cmd, "/helpoff", true) == 0)
{
if(Logged[playerid] == 1)
{
HelpActivated = 0;
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command.");
}
return 1;
}
if(strcmp(cmd, "/help", true) == 0)
{
if(HelpActivated == 1)
{
SendClientMessage(playerid,COLOR_WHITE,"Help text...");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"This command has been desactivated");
}
return 1;
}
Tell me if it works / works better
yeah it works thank you!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)