Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new bool:ShutDown; // Add this to the top of your script
- // This is your command, change the RCON Admin restriction if you want to; up to you.
- CMD:lockserver(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, -1, "Notice: You don't have access to this command.");
- new string[200];
- if(ShutDown)
- {
- ShutDown = false;
- SendRconCommand("password 0");
- SendRconCommand("hostname YourServerNameHere");
- format(string, sizeof(string), "Notice: %s unlocked the server.", ReturnName(playerid));
- SendClientMessageToAll(-1, string);
- }
- else
- {
- ShutDown = true;
- SendRconCommand("password YourPasswordHere");
- SendRconCommand("hostname YourServerNameHere [Locked]");
- format(string, sizeof(string), "Notice: %s locked the server.", ReturnName(playerid));
- SendClientMessageToAll(-1, string);
- }
- return 1;
- }
- // This is the stock that returns the name of a player connected to the server, with the use of their ID.
- // If you already have a stock like this in your gamemode, you can do the replacements and configurations.
- stock ReturnName(playerid)
- {
- new name[90], character[MAX_PLAYER_NAME];
- GetPlayerName(playerid, character, sizeof(character));
- name = character;
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment