/lock server command
#1

Does anyone know how do I lock a server using a command (not through RCON!)

/lock [passhere]

(with explanation please)
Reply
#2

you have to create a command-code where you have to use SendRconCommand("password text");
Reply
#3

why wouldnt you use a rcon command?
Reply
#4

I don't want to give RCON to each and every admin lol.
Reply
#5

start a creating of command, if u need an assistance, just ask and I'll help u.
Reply
#6

you dont need to give someone rcon to let them put a server password.


for example you can use it via a sscanf command or via an input text dialog

PHP код:
            new serverpass[25];
            
strmid(serverpassinputtext0strlen(inputtext), 999);
            
format(string,sizeof(string),"password %s",serverpass);
            
SendRconCommand(string); 
just set a condition for the command ( admin 1+ for example) and you`re fine.
Reply
#7

I've made this

Код:
CMD:lock(playerid, params[])
{
   if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
   if(pInfo[playerid][Admin] < 1)  return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
   {
	  new str[128];
	  if(sscanf(params, "s[128]", str)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /lock [password]");
	  format(str, sizeof(str), "{c3c3c3}(INFO) Password: %s", params);
	  SendRconCommand("password text");
	  format(str, sizeof(str), "{9d64d0}(INFO) An admin has locked the server! (PASSWORD: %s)", params);
	  SendMessageToAdmins(str);
   }
   return 1;
}
So far working but, The password is only "text"

" SendRconCommand("password text");" How do I modify it so it sets to what I set it to?
Reply
#8

use this code
PHP код:
        new pass[64];
        
format(pass,sizeof(pass),"password %s",params);
        
SendRconCommand(pass); 
PHP код:
CMD:lock(playeridparams[])
{
   if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
   if(
pInfo[playerid][Admin] < 1)  return SendClientMessage(playerid, -1"{C3C3C3}(INFO) You don't have the priviliges to use this command.");
   {
        new 
str[128];
        if(
sscanf(params"s[128]"str)) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) /lock [password]");
        
format(strsizeof(str), "{c3c3c3}(INFO) Password: %s"params);
        new 
pass[64];
        
format(pass,sizeof(pass),"password %s",params);
        
SendRconCommand(pass);
        
format(strsizeof(str), "{9d64d0}(INFO) An admin has locked the server! (PASSWORD: %s)"params);
        
SendMessageToAdmins(str);
   }
   return 
1;

Reply
#9

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
use this code
PHP код:
        new pass[64];
        
format(pass,sizeof(pass),"password %s",params);
        
SendRconCommand(pass); 
PHP код:
CMD:lock(playeridparams[])
{
   if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
   if(
pInfo[playerid][Admin] < 1)  return SendClientMessage(playerid, -1"{C3C3C3}(INFO) You don't have the priviliges to use this command.");
   {
        new 
str[128];
        if(
sscanf(params"s[128]"str)) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) /lock [password]");
        
format(strsizeof(str), "{c3c3c3}(INFO) Password: %s"params);
        new 
pass[64];
        
format(pass,sizeof(pass),"password %s",params);
        
SendRconCommand(pass);
        
format(strsizeof(str), "{9d64d0}(INFO) An admin has locked the server! (PASSWORD: %s)"params);
        
SendMessageToAdmins(str);
   }
   return 
1;

thanks buddy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)