/find - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /find (
/showthread.php?tid=478229)
/find -
kalanerik99 - 28.11.2013
Hi!
Can some one help me with this?
I want that player will type /find [playername-not playerid] it will show him players with that words in name in dialog
>Like this but the code done work
PHP код:
CMD:find(playerid,params[])
{
new name;
new count = 0;
if(sscanf(params, "u", name)) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /Find [PlayerName]");
foreach (new i : Player)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i,name, sizeof(name));
new Find[1000];
format(Find, sizeof(Find), "{FFFFFF}%s(ID:%d)", name, i);
ShowPlayerDialog(playerid,9001,DIALOG_STYLE_LIST,"Find",Find,"Ok","");
}
}
return 1;
}
Re: /find -
Konstantinos - 28.11.2013
pawn Код:
CMD:find( playerid, params[ ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, 0xAFAFAFAA, "USAGE: /Find [PlayerName]" );
new
count,
name[ MAX_PLAYER_NAME ],
sz_Find[ 256 ] = "{FFFFFF}"
;
foreach(new i : Player)
{
GetPlayerName( i, name, MAX_PLAYER_NAME );
if( strfind( name, params, true ) != -1 )
{
format( sz_Find, sizeof( sz_Find ), "%s%s(ID:%d)\n", sz_Find, name, i );
count++;
}
}
if( !count ) SendClientMessage( playerid, -1, "No results" );
else ShowPlayerDialog( playerid, 9001, DIALOG_STYLE_MSGBOX, "Find", sz_Find, "Ok", "" );
return 1;
}