How to make 2actions with 1 command?
#1

Okey, I would need a little bit of help.
I want to use 1 command to enable and disable a function for my server. But I dont remember
how I made it. So thats why Im asking

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

	if (strcmp("/Enable", cmdtext, true) == 0)
	{
		AMAZ[playerid] = 1;
		SendClientMessage(playerid,COLOR_GREEN,"Enabled");
		return 1;
	}
	if (strcmp("/Disable", cmdtext, true) == 0)
	{
		SendClientMessage(playerid,COLOR_GREEN,"Disabled");
		AMAZ[playerid] = 0;
		return 1;
	}
	return 0;
}
I want those 2 turn into 1 commands.
So instead of typing /enable and /disable I just want 1 commands like /boom :P
Reply
#2

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Boom", cmdtext, true) == 0)
	{
                if(AMAZ[playerid] == 0) {
		AMAZ[playerid] = 1;
		SendClientMessage(playerid,COLOR_GREEN,"Enabled"); 
                }
                 else
               {
                SendClientMessage(playerid,COLOR_GREEN,"Disabled");
		AMAZ[playerid] = 0;
               }
		return 1;
	}
	return 0;
}
Reply
#3

ahh, Simple xD
Thanks for the fast response
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)