[Ajuda] Como criar um comando /Prender [ID] [Minutos] [Motivo] para Admin
#3

Vк se esse server pra vocк
pawn Код:
COMMAND:prender(playerid, params[])
{
    new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/prender", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 2)
        {
            if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Use: /prender [id] [tempo] [motivo]");
            else
                if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                {
                    // Jail the player
                    Police_JailPlayer(PlayerToJail, JailTime);
                    // Get the name of the player who jailed the player
                    GetPlayerName(playerid, AdminName, sizeof(AdminName));
                    // Get the name of the player who's being sent to jail
                    GetPlayerName(PlayerToJail, Name, sizeof(Name));
                    // Send the jailed player a message who jailed him, why he's been jailed and how long
                    format(Msg, 128, "Vocк foi preso por %s %s por %i segundos.", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "Motivo: %s", Reason);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "{00FF00}Vocк prendeu {FFFF00}%s{00FF00} por {FFFF00}%i{00FF00} segundos.", Name, JailTime);
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "Esse jogador nгo estб online.");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)