SA-MP Forums Archive
A simple Help - 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: A simple Help (/showthread.php?tid=237439)



A simple Help - Ironboy - 09.03.2011

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


Re: A simple Help - hadzx - 09.03.2011

add on your server cfg password yourpassword


Re: A simple Help - Ironboy - 09.03.2011

ok ty


Re: A simple Help - Tee - 09.03.2011

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.


Re: A simple Help - Ricop522 - 09.03.2011

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


Re: A simple Help - Ironboy - 09.03.2011

ok ty all