getid dialog
#7

Just a little rewritten
pawn Код:
CMD:getid(playerid, params[]) {
    if(isnull(params)) {
        return SendClientMessage(playerid, 0xFF0000FF, "Usage: /getid [name/id]");
    }
    new
        i = -1,
        tmp[512],
        name[MAX_PLAYER_NAME]
    ;
    while(++i < MAX_PLAYERS) {
        if(GetPlayerName(i, name, sizeof name) && (strfind(name, params, true) != -1)) {
            format(tmp, sizeof tmp, "%s\n%s (ID: %i)", tmp, name, i);
        }
    }
    if(tmp[0] == EOS) {
        return SendClientMessage(playerid, 0xFF0000FF, "There were no matches found.");
    }
    return ShowPlayerDialog(playerid, YOUR_DIALOG_ID, DIALOG_STYLE_LIST, "Players", tmp[1], "Goto", "Close");
}
pawn Код:
//OnDialogResponse
        case YOUR_DIALOG_ID: {
            if(response) {
                new
                    Float: X,
                    Float: Y,
                    Float: Z,
                    giveplayerid = strval(inputtext[strfind(inputtext, "ID:", false) + 3])
                ;
                if(GetPlayerPos(giveplayerid, X, Y, Z)) { // player could have left meanwhile
                    SetPlayerPos(playerid, X, Y, Z);

                    SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
                }
            }
        }
Reply


Messages In This Thread
getid dialog - by gotwarzone - 25.10.2013, 20:25
Re: getid dialog - by DanishHaq - 25.10.2013, 20:35
Re: getid dialog - by gotwarzone - 25.10.2013, 20:41
Re: getid dialog - by gotwarzone - 28.10.2013, 16:54
Re: getid dialog - by -Prodigy- - 28.10.2013, 17:41
Re: getid dialog - by kbalor - 28.10.2013, 18:11
AW: Re: getid dialog - by Nero_3D - 28.10.2013, 19:17
Re: AW: Re: getid dialog - by gotwarzone - 28.10.2013, 19:26
AW: Re: AW: Re: getid dialog - by Nero_3D - 28.10.2013, 19:29
Re: AW: Re: getid dialog - by -Prodigy- - 28.10.2013, 20:10

Forum Jump:


Users browsing this thread: 5 Guest(s)