[+REP]PM Message only appears if less then 40 characters
#1

Here is the code: http://pastebin.com/Nr6Dibby

I don't know why the message only appears if it's small
Reply
#2

Try this

pawn Код:
CMD:pm(playerid,params[])
{
     new text[128],targetid,string[128],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", targetid, text)) SendClientMessage(playerid, COLOR_GREY, "Usage: /pm [playerid] [text]");//if player uses command wrong
    else
    {
        if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot pm to yourself.");//if player try to pm self
        if(IsPlayerConnected(targetid))//check if player online
        {
            format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
            format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
            NameSpace(sendername);
            NameSpace(giveplayer);
            format(string, sizeof(string), ">> PM from %s[%d]: %s <<", sendername, playerid, text);//change format if you want
            SendClientMessage(targetid,  0xF9F900FF, string);
            format(string, sizeof(string), ">> PM sent to %s: %s <<", giveplayer, text);//change format if you want
            SendClientMessage(playerid,  0xE5C43EAA, string);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        }
    }
    return 1;
}


stock NameSpace(str[])
{
    new strl;
    strl=strlen(str);
    while(strl--) {
    if(str[strl]=='_')  str[strl]=' ';
    }
    return 0;
}
Reply
#3

Maybe because there's a lot of characters in there besides the actual private message. The limit for SendClientMessage is 144 characters.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)