Another help with undefine symbol
#10

Yes you can:

pawn Код:
public OnPlayerConnect(playerid)
{
    new set_name[] = "123456789012345678901234";
    SetPlayerName(playerid, set_name);
   
    printf("Setting name length: %i", strlen(set_name));
   
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
   
    printf("GetPlayerName: %s (%i)", name, strlen(name));
    return 1;
}
Output:

[14:06:40] [nick] Mike nick changed to 123456789012345678901234
[14:06:40] Setting name length: 24
[14:06:40] GetPlayerName: 123456789012345678901234 (24)




But oddly, if I do this:

pawn Код:
new set_name[] = "123456789012345678901234";
   
printf("Len: %i", sizeof(set_name));
It's 25 cells..

And
pawn Код:
new set_name[24] = "123456789012345678901234";
Throws an error: initialization data exceeds declared size.

Very odd.



EDIT2: Tried format()..

pawn Код:
new set_name[24];
format(set_name, sizeof(set_name), "123456789012345678901234");
print(set_name);
Cuts off the final character ('4'). I find it odd how GetPlayerName doesn't need a null-terminator.
Reply


Messages In This Thread
Another help with undefine symbol - by RiChArD_A - 11.04.2013, 00:07
Re: Another help with undefine symbol - by stabker - 11.04.2013, 00:13
Re: Another help with undefine symbol - by Pottus - 11.04.2013, 00:16
Re: Another help with undefine symbol - by FunnyBear - 11.04.2013, 00:28
Re: Another help with undefine symbol - by RiChArD_A - 11.04.2013, 01:07
Re: Another help with undefine symbol - by RiChArD_A - 11.04.2013, 22:47
Re: Another help with undefine symbol - by RiChArD_A - 12.04.2013, 11:21
Re: Another help with undefine symbol - by MP2 - 12.04.2013, 12:25
Re: Another help with undefine symbol - by MP2 - 12.04.2013, 12:35
Re: Another help with undefine symbol - by MP2 - 12.04.2013, 12:41

Forum Jump:


Users browsing this thread: 1 Guest(s)