Little help with the /w command
#2

pawn Код:
format(string, sizeof(string), "Admin %s whispers: %s", sendername, playerid);
You need to give the string which contains the whisper text instead of 'playerid'

But anyway, here's one that should work (untested) with dcmd and sscanf:
pawn Код:
// assuming you already have a 'string[128]' defined
dcmd_whisper(playerid, params[])
{
    if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
    {
        new
            TargetID,
            msg[128];
        if (sscanf(params, "us", TargetID, msg) != 0)
        {
            SendClientMessage(playerid, ADMIN_RED, "Usage: /whisper <Target ID or name> <text>");
            SendClientMessage(playerid, ADMIN_RED, "Alternatives: /w, /whisper");
            return 1;
        }
        if (IsPlayerConnected(TargetID))
        {
            format(string, sizeof(string), "Admin %s whispers: %s", GetPlayerName2(playerid), msg);
            SendClientMessage(TargetID, YELLOW, string);
            return 1;
        }
        else return SendClientMessage(playerid, ADMIN_RED, "Player not found!");
    }
    else SendClientMessage(playerid, ADMIN_RED, "This is a level 1 command!");
    return 1;
}
dcmd_w(playerid, params[])
{
    return dcmd_whisper(playerid, params);
}
pawn Код:
stock GetPlayerName2(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    return pname;
}
// in case you need it
Reply


Messages In This Thread
Little help with the /w command - by Striker_Moe - 31.08.2009, 16:20
Re: Little help with the /w command - by Clavius - 31.08.2009, 16:35
Re: Little help with the /w command - by Striker_Moe - 31.08.2009, 16:42
Re: Little help with the /w command - by Clavius - 31.08.2009, 16:57
Re: Little help with the /w command - by Striker_Moe - 31.08.2009, 16:59
Re: Little help with the /w command - by Clavius - 31.08.2009, 17:04
Re: Little help with the /w command - by Striker_Moe - 31.08.2009, 17:06
Re: Little help with the /w command - by Clavius - 31.08.2009, 17:12
Re: Little help with the /w command - by Striker_Moe - 31.08.2009, 17:16
Re: Little help with the /w command - by Clavius - 31.08.2009, 17:21

Forum Jump:


Users browsing this thread: 1 Guest(s)