Need help about chat
#1

i made a pm command and when i send pm it doesnt show all the message just the half.
i mean Example:
pawn Код:
/pm 1 hello how are you this is testing private message man.
and it will send just the half message like
pawn Код:
/pm 1 hello how are yo
Can anyone explain me? i tried many ways i know but the bug still happends
Reply
#2

i think i can help if you show me the Command
Reply
#3

thats because the string in which message is storing is too short increase its size of the string in which u are storing pm message
Reply
#4

You didn't make the string large enough.

Show us the code and we can tell you how to fix it.
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
thats because the string in which message is storing is too short increase its size of the string in which u are storing pm message
yes that is what i tried i change the size of string but there is the same problem...

Edit:
this is the cmd
pawn Код:
CMD:pm(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, -1, "USE: {FFFF00}/pm {FFFFFF}<id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} Player not connected");
if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s [ID %d]: %s", Name2, id, str2);
SendClientMessage(playerid, yellow, str);
format(str, sizeof(str), "PM From %s [ID %d]: %s", Name1, playerid, str2);
SendClientMessage(id, yellow, str);
}
Reply
#6

a question ; in this line
pawn Код:
if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
why is a " { " there that should not be there
and at end of ur command write return 1;
Reply
#7

pawn Код:
CMD:pm(playerid, params[])
{
    new string[128],msg[128], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", id, msg)) //Using 's' in sscanf is to signify a string, you have to signify the size aswell though.. so "us[128]"
    {
        return SendClientMessage(playerid, -1, "USE: {FFFF00}/pm {FFFFFF}<id> <message>");
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} Player not connected");
    if(playerid == id) return SendClientMessage(playerid, red,"ERROR: {FFFFFF} You cannot pm yourself!");
   
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "PM To %s [ID %d]: %s", Name2, id, msg);
    SendClientMessage(playerid, yellow, str);
    format(str, sizeof(str), "PM From %s [ID %d]: %s", Name1, playerid, msg);
    SendClientMessage(id, yellow, str);
        return 1;
}
EDIT: Whoops, thanks BroZeus
Reply
#8

Jason u forgot "return 1;" at end of command
Reply
#9

BroZeus no i didnt forgot it

and

@EiresJason thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)