Command Help.
#5

I think sscanf is easier + faster here is a version of what you want that should work.

pawn Код:
if (!strcmp("/playername", cmdtext, false, 11))
{
    new id;
    if(sscanf(params,"d",id))return SendClientMessage(playerid,0xff0000FF,"USAGE: /playername [ID]");
    {
        if(id != INVALID_PLAER_ID)
        {
            new str[128];
            format(str,128,"ID:%i Is Player Name:%s",id,PlayerName(playerid));
            SendClientMessage(playerid,0xff0000FF,str);
            return true;
        }
        else return SendClientMessage(playerid,0xff0000FF,"ERROR: player not found!");
    }
}
and at bottom of script
pawn Код:
stock PlayerName(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    return pname;
}
Note you will need the sscanf include or sscanf 2.0(plugin) for this method.
Reply


Messages In This Thread
Command Help. - by CSMajor - 28.07.2010, 15:59
Re: Command Help. - by Kar - 28.07.2010, 16:02
Re: Command Help. - by Vince - 28.07.2010, 16:04
Re: Command Help. - by Conroy - 28.07.2010, 16:06
Re: Command Help. - by iggy1 - 28.07.2010, 16:24
Re: Command Help. - by CSMajor - 28.07.2010, 16:47
Re: Command Help. - by iggy1 - 28.07.2010, 16:53
Re: Command Help. - by CSMajor - 28.07.2010, 17:04

Forum Jump:


Users browsing this thread: 1 Guest(s)