Admin Command
#1

How to make /lockserver as a admin command?


Код:
CMD:lockserver(playerid, params[])
{
    SendAdminText(playerid, "/lockserver", params);
    if (APlayerData[playerid][PlayerLevel] >= 7)
    if(isnull(params))
        return SendClientMessage(playerid, 0xFF0000AA, "ERROR: /lockserver [password]");
    if(strlen(params) < 5 || strlen(params) > 30)
        return SendClientMessage(playerid, 0xFF0000AA, "ERROR: The password must be between 5 and 30 characters.");

    new
        szString[128]
    ;
    new str[64];
    format(szString, sizeof(szString), "You have set the server password to: %s", params);
    SendClientMessage(playerid, 0xFF0000AA, szString);
    new strPName[24];
    format(szString, sizeof(szString), "password %s", params);
    GetPlayerName(playerid, strPName, sizeof(strPName));
    format(str, sizeof(str), "Admin %s has locked the server", strPName);
    SendClientMessageToAll(0xFFFF00AA, str);
    SendRconCommand(szString);
    return 1;
}
Reply
#2

what's wrong with that code? Looks fine to me. Although if you were wanting to remove all players from the server then you'd need to use a loop.
Reply
#3

pawn Код:
CMD:lockserver(playerid, params[])
{
    if(APlayerData[playerid][PlayerLevel] >= 7 || IsPlayerAdmin(playerid))
    if(isnull(params))
    return SendClientMessage(playerid, 0xFF0000AA, "Usage: /lockserver [password]");
    if(strlen(params) < 5 || strlen(params) > 30)
    return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}Error: {FFFFFF} Limit 5-30 letters");
    new szString[128];
    format(szString, sizeof(szString), "You have set the server password to: %s", params);
    SendClientMessage(playerid, 0xFF0000AA, szString);
    format(szString, sizeof(szString), "password %s", params);
    SendRconCommand(szString);
    return 1;
}
Reply
#4

Код:
CMD:lockserver(playerid, params[])
{
    if(IsPlayerAdmin ( playerid ) )
    {
    SendAdminText(playerid, "/lockserver", params);
    if (APlayerData[playerid][PlayerLevel] >= 7)
    if(isnull(params))
        return SendClientMessage(playerid, 0xFF0000AA, "ERROR: /lockserver [password]");
    if(strlen(params) < 5 || strlen(params) > 30)
        return SendClientMessage(playerid, 0xFF0000AA, "ERROR: The password must be between 5 and 30 characters.");

    new
        szString[128]
    ;
    new str[64];
    format(szString, sizeof(szString), "You have set the server password to: %s", params);
    SendClientMessage(playerid, 0xFF0000AA, szString);
    new strPName[24];
    format(szString, sizeof(szString), "password %s", params);
    GetPlayerName(playerid, strPName, sizeof(strPName));
    format(str, sizeof(str), "Admin %s has locked the server", strPName);
    SendClientMessageToAll(0xFFFF00AA, str);
    SendRconCommand(szString);
    }
    else return SendClientMessage ( playerid , -1, "You must be rcon admin to use this command" ) ;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)