zcmd /pm help
#3

Use sscanf.. it's simple and efficient

pawn Код:
CMD:pm(playerid, params[])
{
    new targetid;
    if(sscanf(params, "us[128]", targetid, str128)) return SendClientMessage(playerid, WHITE, "Use: /pm [player] [text]");
    if(targetid != INVALID_PLAYER_ID)
    {
        if(targetid == playerid) SendClientMessage(playerid, LIME, "You cannot PM yourself.");
        else CallLocalFunction("OnPlayerPrivmsg", "dds", playerid, targetid, str128);
    }
    else SendClientMessage(playerid, LIME, "Player is not connected.");
    return 1;
}
pawn Код:
PUBLIC:OnPlayerPrivmsg(playerid, recieverid, text[])
{
    format(str128, 128, "PM from %s(ID:%d): %s", PlayerName[playerid], playerid, text);
    SendClientMessage(recieverid, YELLOW, str128);
    format(str128, 128, "PM to %s(ID:%d): %s", PlayerName[recieverid], recieverid, text);
    SendClientMessage(playerid, YELLOW, str128);
    printf("[pm] %s PM'ed %s: %s", PlayerName[playerid], PlayerName[recieverid], text);
    return 0;
}
Ops, too late ...
Reply


Messages In This Thread
zcmd /pm help - by ricardo178 - 12.03.2011, 19:40
Re: zcmd /pm help - by xir - 12.03.2011, 19:47
Re: zcmd /pm help - by iMonk3y - 12.03.2011, 19:49
Re: zcmd /pm help - by Scrip - 12.03.2011, 19:55
Re: zcmd /pm help - by ricardo178 - 12.03.2011, 20:24

Forum Jump:


Users browsing this thread: 2 Guest(s)