[Pedido] Imput text para enviar o texto ao adm
#1

Pedido: Exibir o dialog em input text e enviar o texto digitado pelo player ao administrador..

pawn Код:
COMMAND:admins(playerid, params[])
{
    // Setup local variables
    new AdminList[500], Name[24];

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

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Scan through all players
        for (new i; i < MAX_PLAYERS; i++)
        {
            // Check if this player is connected
            if (IsPlayerConnected(i))
            {
                // Get the name of the player
                GetPlayerName(i, Name, sizeof(Name));

                // Check if this player is an RCON admin
                if (IsPlayerAdmin(i))
                {
                    // Add all admin players to the list
                    format(AdminList, 500, "RCON - %s{FFFFFF}%s (ID: %i) й um %s {FFFFFF}(Level: %i)\n", AdminList, Name, i, AdminLevelName[APlayerData[i][PlayerLevel]], APlayerData[i][PlayerLevel]);
                    // Re-start the for loop (skipping the remaining code for this iteration)
                    continue;
                }

                //Check if that player is an admin (using the PlayerLevel)
                if (APlayerData[i][PlayerLevel] > 0)
                {
                    // Add all admin players to the list
                    format(AdminList, 500, "%s{FFFFFF}%s (ID: %i) й um %s {FFFFFF}(Level: %i)\n", AdminList, Name, i, AdminLevelName[APlayerData[i][PlayerLevel]], APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
                }
            }
        }

        // Check if there were admin-names added to the list
        if (strlen(AdminList) > 0)
            ShowPlayerDialog(playerid, 8912DialogNoResponse, DIALOG_STYLE_MSGBOX, "{FF0000}Adminstradores Online:", AdminList, "OK", "Cancel");
        else
            SendClientMessage(playerid, 0xFF0000FF, "Nгo tem administradores online no momento!"); // No admins are online
    }
    else
        return 0;

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

Exemplo bбsico:

pawn Код:
COMMAND:ajuda(playerid, params[])
{
     // Setup local variables
    new AdminList[500], Name[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/admins", params);
    if (APlayerData[playerid][LoggedIn] == true)
    {
        for (new i; i < MAX_PLAYERS; i++)
        {
            // Check if this player is connected
            if (IsPlayerConnected(i))
            {
                // Get the name of the player
                GetPlayerName(i, Name, sizeof(Name));

                // Check if this player is an RCON admin
                if (IsPlayerAdmin(i))
                {
                    // Add all admin players to the list
                    format(AdminList, 500, "RCON - %s{FFFFFF}%s (ID: %i) й um %s {FFFFFF}(Level: %i)\n", AdminList, Name, i, AdminLevelName[APlayerData[i][PlayerLevel]], APlayerData[i][PlayerLevel]);
                    // Re-start the for loop (skipping the remaining code for this iteration)
                    continue;
                }
            }
        }
    }
    return ShowPlayerDialog(playerid, 9000, DIALOG_STYLE_INPUT, AdminList, "Enviar", "Cancelar");
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 9000:
        {
            new string[300];
            new nome[MAX_PLAYER_NAME];
            GetPlayerName(playerid, nome, sizeof(nome));
            format(string, sizeof(string), "%s (ID: %d) enviou --> %s",nome, playerid,inputtext);
            for (new i; i < MAX_PLAYERS; i++)
            {
                if (IsPlayerConnected(i))
                {
                    if (IsPlayerAdmin(i))
                    {
                        SendClientMessage(i, 0xFF0000FF, string);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#3

Й isso que vocк quer? fiz rapidinho
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)