Locking server with NON-RCON COMMAND
#1

how is it possiable to lock server without using /rcon login [mypass] /rcon password [theserverpass]


I though maybe this will work :
Код:
CMD:lockserver(playerid, params[])
{
	new string[128];
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(sscanf(params, "i", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /lockerserver [password]");
	SendRconCommand("password %d", params);
	format(string, sizeof(string), "AdmCmd : %s %s has Locked The Server (PASSWORD: %d) ", RPALN(playerid), RPN(playerid), params);
	SendAdminMessage(COLOR_RED, 1, string);
	format(string, sizeof(string), "AdmCmd: %s has locked the server.", RPN(playerid));
	SendClientMessageToAll(COLOR_LIGHTRED, string);
	return 1;
}
But then I got warning :
Код:
warning 202: number of arguments does not match definition
Which is :
Код:
SendRconCommand("password %d", params);
I understand that with SendRconCommand should be just ("password [NUMBER]"); . But I want to choose the number with /lockserver [pass] and that automatiaclly will send rconcommand "password [pass]"

Please help me I really want to make /lock this way for my admins so they won't login to rcon ... :\
Reply
#2

pawn Код:
CMD:lockserver(playerid, params[])
{
    new string[128];

    if(!IsPlayerLoggedIn(playerid))    
        return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    if(isnull(params))
        return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /lockerserver [password]");

    format(string, sizeof(string), "password %s", params);
    SendRconCommand(string);

    format(string, sizeof(string), "AdmCmd : %s %s has Locked The Server (PASSWORD: %s) ", RPALN(playerid), RPN(playerid), params);
    SendAdminMessage(COLOR_RED, 1, string);
   
    format(string, sizeof(string), "AdmCmd: %s has locked the server.", RPN(playerid));
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    return 1;
}
You're using the wrong Placeholder
Reply
#3

I'm not sure if you can use password via SendRconCommand. Anyways:
pawn Код:
CMD:lockserver(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /lockerserver [password]");
    new string[128];
    format(string, sizeof(string), "password %s", params);
    SendRconCommand(string);
    format(string, sizeof(string), "AdmCmd : %s %s has Locked The Server (PASSWORD: %s) ", RPALN(playerid), RPN(playerid), params);
    SendAdminMessage(COLOR_RED, 1, string);
    format(string, sizeof(string), "AdmCmd: %s has locked the server.", RPN(playerid));
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    return 1;
}
Reply
#4

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
pawn Код:
CMD:lockserver(playerid, params[])
{
    new string[128];

    if(!IsPlayerLoggedIn(playerid))    
        return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");

    if(isnull(params))
        return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /lockerserver [password]");

    SendRconCommand("password %s", params);

    format(string, sizeof(string), "AdmCmd : %s %s has Locked The Server (PASSWORD: %s) ", RPALN(playerid), RPN(playerid), params);
    SendAdminMessage(COLOR_RED, 1, string);
   
    format(string, sizeof(string), "AdmCmd: %s has locked the server.", RPN(playerid));
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    return 1;
}
You're using the wrong Placeholder
Yet Warning: "warning 202: number of arguments does not match definition"
Line: "SendRconCommand("password %s", params);"

And I was suree %d is for numbers and not %s.

Any else solutions?
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I'm not sure if you can use password via SendRconCommand. Anyways:
pawn Код:
CMD:lockserver(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /lockerserver [password]");
    new string[128];
    format(string, sizeof(string), "password %s", params);
    SendRconCommand(string);
    format(string, sizeof(string), "AdmCmd : %s %s has Locked The Server (PASSWORD: %s) ", RPALN(playerid), RPN(playerid), params);
    SendAdminMessage(COLOR_RED, 1, string);
    format(string, sizeof(string), "AdmCmd: %s has locked the server.", RPN(playerid));
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    return 1;
}
Yes! this one worked thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)