Help with string problem [again]
#1

Here i am requesting help yet again

pawn Code:
C: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, "Usage: /pm <id> <message>");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
    {

        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, 0xFF0000FF, str);
        format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2); //mistake past here i think
        SendClientMessage(id, 0xFF0000FF, str);
        printf("PM SENT from %s (ID %d) to %s",Name1,playerid,str2);
    }
    return 1;
}
The above is working fine, its printing to console. But its reading as:
Code:
PM sent from Dobby (ID 0) to test
When i want it to read:

Code:
PM sent from Dobby (ID 0 to TheEpix(ID 1): test
Im also getting the following printed:

Code:
[02:07:59] sscanf warning: Strings without a length are deprecated, please add a destination size.
[02:07:59] PM SENT from Dobby (ID 0) to test
[02:08:05] [chat] [Dobby]: get that?
[02:08:16] sscanf warning: Strings without a length are deprecated, please add a destination size. //THIS
[02:08:16] PM SENT from TheEpix (ID 1) to got it
[02:08:24] sscanf warning: Strings without a length are deprecated, please add a destination size.
[02:08:24] PM SENT from Dobby (ID 0) to ok :) just checking console
I was told i had to set the size of the string, i've tried it. But i get the "shadows variable at preceeding level" warning. So i've deleted it. Obviously as i was advised to. But still the same thing happens. Help is apprecitated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)