Long Nickname Crashes Server?
#7

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
This is your problem:
PHP код:
new string[128]; 
PHP код:
format(string, 256, ""p"Hrбč "w"%s"p" vypsal odměnu na hrбče "w"%s"p" . Vypsanб odměna - "w"$%d",jmeno , jmeno2, PlayerInfo[pID][Hitman]); 
You are declaring a variable with 128 cells, yet you format the variable passing a much larger amount of cells as second argument (256). And once the formatted string reaches a length of 128 and more, it will crash the server.

You're much safer using sizeof:
PHP код:
format(string, sizeof(string), "%d", variable); 
Plus, it makes your code easier to maintain in the long run.

FYI: MAX_PLAYER_NAME is defined as 24, but the maximum length of a player's name is actually 20: https://sampwiki.blast.hk/wiki/GetPlayerName
I still don't quite understand what's going on with MAX_PLAYER_NAME lol. So you can connect to a server with a nickname between 3 and 20 characters, however when you use SetPlayerName(https://sampwiki.blast.hk/wiki/SetPlayerName) you can choose a nickname between 1 and 24 characters, I wonder why they did that.
Reply


Messages In This Thread
Long Nickname Crashes Server? - by Daveosss - 09.04.2016, 17:20
Re: Long Nickname Crashes Server? - by Abagail - 09.04.2016, 17:36
Re: Long Nickname Crashes Server? - by ]Rafaellos[ - 09.04.2016, 17:36
Re: Long Nickname Crashes Server? - by Daveosss - 09.04.2016, 19:02
Re: Long Nickname Crashes Server? - by AndySedeyn - 09.04.2016, 19:14
Re: Long Nickname Crashes Server? - by Daveosss - 09.04.2016, 20:09
Re: Long Nickname Crashes Server? - by MartinSwag - 09.04.2016, 21:42

Forum Jump:


Users browsing this thread: 1 Guest(s)