House Password?
#1

Hello all, i was thinking..that i need a password for one of my admin houses, so how would i do that?
Because ive already set the Isplayeradmin thing but i need a password to verify it, so any ideas please?

P.S Its off crazybobs
Reply
#2

Try something like

pawn Код:
new PasswordScreen[MAX_PLAYERS]; // Top of your script

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
      if(PlayerToPoint(2, playerid, HouseX, HouseY, HouseZ); //fill your house icon co-ords in here
      {
        if(IsPlayerAdmin(playerid))
        {
          PasswordScreen[playerid] = 1;
          SendClientMessage(playerid, YourColorHere, "Press T and type in the password");
            }
        }
        return 1;
    }
    return 0;
}

public OnPlayerText(playerid, text[])
{
    if(PasswordScreen[playerid] == 1)
    {
      PasswordScreen[playerid] = 0;
      if(strcmp(text, "PutThePasswordInHere", 1) == 0) //Fill in the house password
      {
        //Password is correct
        //House stuff goes in here, SetPlayerPos, SetPlayerInterior etc etc
        }
        else SendClientMessage(playerid, YourColorHere, "Incorrect Password"); //Password is incorrect
        return 0;
    }
    return 1;
}
You will need PlayerToPoint for that, or just edit it to whatever you use for that stuff.

Note: Untested. and indentation looks horrible on the forums.
Reply
#3

Quote:
Originally Posted by Gappy
Try something like

pawn Код:
new PasswordScreen[MAX_PLAYERS]; // Top of your script

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
      if(PlayerToPoint(2, playerid, HouseX, HouseY, HouseZ); //fill your house icon co-ords in here
      {
        if(IsPlayerAdmin(playerid))
        {
          PasswordScreen[playerid] = 1;
          SendClientMessage(playerid, YourColorHere, "Press T and type in the password");
            }
        }
        return 1;
    }
    return 0;
}

public OnPlayerText(playerid, text[])
{
    if(PasswordScreen[playerid] == 1)
    {
      PasswordScreen[playerid] = 0;
      if(strcmp(text, "PutThePasswordInHere", 1) == 0) //Fill in the house password
      {
        //Password is correct
        //House stuff goes in here, SetPlayerPos, SetPlayerInterior etc etc
        }
        else SendClientMessage(playerid, YourColorHere, "Incorrect Password"); //Password is incorrect
        return 0;
    }
    return 1;
}
You will need PlayerToPoint for that, or just edit it to whatever you use for that stuff.

Note: Untested. and indentation looks horrible on the forums.
Alrite thanks for that ^^ ill test it out now
Reply
#4

I've tested it, Works fine
Reply
#5

If you're using a player command (in this example "/enter"), wouldn't it be easier for the player to type "/enter [password]" rather then having to open the chatbox again and type the password?
Reply
#6

Thanks it works like a charm
Reply
#7

No Probs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)