#1

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(playerid0xAFAFAFAA"USAGE: /Find [PlayerName]");
foreach (new 
Player)
{
if(
IsPlayerConnected(i))
{
GetPlayerName(i,namesizeof(name));
new 
Find[1000];
format(Findsizeof(Find), "{FFFFFF}%s(ID:%d)"namei);
ShowPlayerDialog(playerid,9001,DIALOG_STYLE_LIST,"Find",Find,"Ok","");
}
}
return 
1;

Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)