Search players in dialog? Possible?
#1

Its kinda obvious that its possible to do.

OK so a dialog that will give you an option to type a player's name inside and search this player.

If anyone can help I'll be happy

Thanks, Adam
Reply
#2

Just make an input dialog whenever you want the player to search a player. For example, a command.

pawn Code:
#define DIALOG_PLAYER_SEARCH (1)

ShowPlayerDialog(playerid,DIALOG_PLAYER_SEARCH, DIALOG_STYLE_INPUT, "Search", "Type a players name to search it!", "Search", "Cancel");
Then OnDialogResponse

pawn Code:
switch(dialogid)
{
    case DIALOG_PLAYER_SEARCH:
    {
        //Do whatever you want it to do with inputtext, which is what they type
    }
}
You weren't specific what-so-ever, you didn't say you wanted it to check a database (mysql) or files for the name, etc, or if you just wanted online players, etc.
Reply
#3

Hey Kin, thanks.
Mobile Data Computer - thats what the input will be for.
After you type his name you need to search for example the player's registered houses
lemme show you an example
pawn Code:
COMMAND:MDCtest(playerid, params[])
{
    if(IsPlayerFED(playerid) || PlayerInfo[playerid][power] >= 10)
    {
        new carid = GetPlayerNearestVehicle(playerid);
        if(GetDistanceFromPlayerToVehicle(playerid, carid) > 8.0) return SendClientError(playerid, "You must be inside a PD vehicle or outside it to use the MDC!");
        if(Vehicles[carid][carteam]==COPS || Vehicles[carid][carteam]==SASF || Vehicles[carid][carteam]==FBI)
        {
            ShowPlayerDialog(playerid, 200, DIALOG_STYLE_LIST, "LSPD Mobile Data Computer", "\
            Registered houses\n\
            Registered businesses\n\
            Registered vehicles\n\
            Registered phone\n\
            Pervious convictions"
, "Select", "Select");
        }
    }
    else return SendClientError(playerid, CANT_USE_CMD);
    return 1;
}
this is the dilaog response --
pawn Code:
if(dialogid == 201 && response == 1)
    {
    if(!PlayerInfo[playerid][power]) return SendClientError(playerid, CANT_USE_CMD);
    new iName[MAX_PLAYER_NAME];
    if( sscanf ( params, "s", iName) || strlen(params) > MAX_PLAYER_NAME)  return SCP(playerid, "[Name]");
    SendClientMessage(playerid, COLOR_HELPEROOC, "=====================================================");
    SendClientMSG(playerid, COLOR_HELPEROOC, "- HOUSES which have \"%s\" as owner:", iName);
    new tmp2[ 30 ];
    for(new i; i < sizeof(House); i++)
    {
        format(iStr, sizeof(iStr), "Casa%d.txt", i);
        if(strcmp(House[i][tmpowner], iName, false)) continue;
        SendClientMSG(playerid, COLOR_LIGHTGREY, " HouseID[%d] Owner[%s] Till[$%d]", i, iName, dini_Int(tmp2, "till"));
    }
    SendClientMessage(playerid, COLOR_HELPEROOC, "=====================================================");
            return 1;
    }
    else if(dialogid == 201 && response == 0) return SendClientMessage(playerid, COLOR_RED, "Cancelled.");
Havent tested it yet It wont work probably I'm working on it right now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)