If (IsPlayerInVehicle()) - GameTextForAll()
#14

Quote:
Originally Posted by Shinzei_Banzai
Quote:
Originally Posted by Don Correlli
Just set a variable in the command 1 and use the if-statement to check the variable in the command 2.
I'm too big of an amateur to understand that.. Something like this maybe?:
Here's my example-code (i didn't tested this):
pawn Код:
new bool:myVariable = false;

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/mycommand1", true) == 0)
  {
    if(myVariable == false)
    {
      myVariable = true; // set variable to true.
    }
    else if(myVariable == true)
    {
      myVariable = false; // set variable to false.
    }
    return 1;
  }
 
  if(strcmp(cmdtext, "/mycommand2", true) == 0)
  {
    if(myVariable == true)
    {
      // myVariable is true, you can execute your code.
    }
    else if(myVariable == false)
    {
      // myVariable is NOT true (it's false), send message that user can't use this command.
    }
    return 1;
  }
  return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)