SA-MP Forums Archive
[>>REALY<< LITTLE HELP] How to make a switch off system for a command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [>>REALY<< LITTLE HELP] How to make a switch off system for a command (/showthread.php?tid=102655)



[>>REALY<< LITTLE HELP] How to make a switch off system for a command - Mirkan - 16.10.2009

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


Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - Mirkan - 16.10.2009

I changed the link.. I forgot something...


Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - dice7 - 16.10.2009

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


Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - Striker_Moe - 16.10.2009

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;



Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - Mirkan - 16.10.2009

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


Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - JonyAvati - 16.10.2009

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


Re: [>>REALY<< LITTLE HELP] How to make a switch off system for a command - Mirkan - 16.10.2009

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!