SA-MP Forums Archive
Command Lock - 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: Command Lock (/showthread.php?tid=195551)



Command Lock - Rokzlive - 03.12.2010

Is there a command that locks the server? Or how do i code one? I want it so i say /lock as a rcon admin and the server locks until restarted.


Re: Command Lock - 6d - 03.12.2010

pawn Код:
public OnPlayerConnect(playerid)
{
    if(serverstat==0)
    {
        Kick(playerid);
    }
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lockserver", cmdtext, true, 10) == 0)
    {
        if(serverstat==1)
        {
            SendClientMessage(playerid, 0xFF0000, "Server Un-Locked...");
            serverstat=0;
        }else{
            SendClientMessage(playerid, 0xFF0000, "Server Locked...");
            serverstat=1;
        }
        return 1;
    }
    return 0;
}
Not the best way but was a quick method, You can modify, improve it. etc.