SA-MP Forums Archive
Admin Command - 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)
+--- Thread: Admin Command (/showthread.php?tid=437595)



Admin Command - DerickClark - 16.05.2013

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;
}



Re: Admin Command - Isolated - 16.05.2013

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.


Re: Admin Command - NathNathii - 16.05.2013

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;
}



Re: Admin Command - Rimmon - 16.05.2013

Код:
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;
}