A simple Help
#1

hello!
how to lock the server?
When a player try to join then it shows box in which we should write the server password.
Reply
#2

add on your server cfg password yourpassword
Reply
#3

ok ty
Reply
#4

Or go to your server. Login as RCON. Type /rcon password [whatever you want it to be]. Then you can look at the SA-MP Client and see that the server is unlocked. To disable the password type /rcon password 0.
Reply
#5

Try this

pawn Код:
new locked = 0;
new passerver = 0;


public OnPlayerConnect...
{
     if(locked == 1)
     {
        //Make the dialog!
        return 1;
     }
}


//dialogresponse

if(dialogid == ID_DIALOG)
{
     if(strval(inputtext) == passerver)
     {
      //if is right, do what you wanna.
     }
     else
     {
      SendClientMessage(playerid, 0xFFFFFFAA, "Wrong server password!");
      Kick(playerid);
      return 1;
     }
}


//the command

if(strcmp(cmd,"/lockserver", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
           if(locked == 0)
           {
                locked = 1;
                //message...
           }
           else
           {
                locked = 0;
                //message unlocked.
           }
        }
        return 1;
    }
   

if(strcmp(cmd, "/serverpassword", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USE: /serverpassword [password]");
            return 1;
        }
        new passwordx = strval(tmp)
        GetPlayerName(playerid, sendername, sizeof(sendername));
        passerver = passwordx;
        format(string, sizeof(string), "New server password %d.", passwordx);
        SendClientMessage(playerid, 0xFFFFFFAA, string);
        return 1;
    }
I don't test this.
good luck
Reply
#6

ok ty all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)