PM Command
#1

Hello, I'm making a PM command from name.

The code is this :

pawn Код:
CMD:pm(playerid, params[])
{
        new reciever[25], message[100], id;
        if (sscanf(params, "r[25]s[100]", reciever, message))
        return SendClientMessage(playerid, 0xFF9900, "Usage: \"/PM <name/part of name> <message>\"");
        id = GetIdFromName(reciever);
        if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");

        new pname[MAX_PLAYER_NAME], msg[100], sendermsg[100];
        GetPlayerName(playerid, pname, sizeof(pname));

        format(msg, sizeof(msg), "PM from %s : %s", pname, message);
        SendClientMessage(id, 0xFFFF00AA, msg);

        format(sendermsg, sizeof(sendermsg), "Message sent !");
        SendClientMessage(playerid, 0xFFFF00AA, sendermsg);

        return 1;
}
With this stock :

pawn Код:
stock GetIdFromName(playername[]) // © by iPLEOMAX
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(i,pname,MAX_PLAYER_NAME);
            if(strfind(pname,playername,true) != -1 && strlen(playername) != 0)
            {
                return i;
            }
        }
    }
    if(strfind(playername, "0",true) != -1 && strlen(playername) <= 1) return 0;
    if(strval(playername) > 0 && strval(playername) <= MAX_PLAYERS) return strval(playername);
    return -1;
}
(And Zcmd stock).

So, my problem is that the reciever doesn't see the message. I explain : The sender recieves "Message sent !", the reciever just recieves "MP from /sender name/ :" and he doesn't have the message.

Why ? Thanks a lot for your answers =)
Reply


Messages In This Thread
PM Command - by ludesert - 05.07.2011, 10:10
Re: PM Command - by [03]Garsino - 05.07.2011, 10:16
Re : PM Command - by ludesert - 05.07.2011, 10:17
Re: PM Command - by Vince - 05.07.2011, 10:47
Re : PM Command - by ludesert - 05.07.2011, 10:50
Re: Re : PM Command - by JaTochNietDan - 05.07.2011, 10:52
Re : PM Command - by ludesert - 05.07.2011, 10:54
Re: PM Command - by JaTochNietDan - 05.07.2011, 10:55
Re : PM Command - by ludesert - 05.07.2011, 12:13
Re: Re : PM Command - by [03]Garsino - 05.07.2011, 13:06

Forum Jump:


Users browsing this thread: 1 Guest(s)