Posts: 512
Threads: 121
Joined: Sep 2013
Quote:
Originally Posted by Nero_3D
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(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)); } } }
|
Thanks man. Really great job! I see that it also targets the player interior and virtual world.
Anyway I got this warning
Код:
(5938) : error 035: argument type mismatch (argument 1)
this line
Код:
giveplayerid = strval(strfind(inputtext, "ID:", false) + 4);
And may I ask if you also fix when targeting a player part of name it should show the list of those who has this part of name?