Error compile.
#4

Quote:
Originally Posted by LarzI
Посмотреть сообщение
This is what you need. Use this thread. Cheers LarzI. Rep+4

You need to reduce cell size where ever required within your game mode. Remember where it is required.

Example:

Lets consider you have this code.
pawn Код:
public OnPlayerConnect(playerid)
{
     new str[256],name[MAX_PLAYER_NAME+1];
     GetPlayerName(playerid, name, sizeof(name));
     format(str,sizeof(str),"Hello %s , Welcome to SA-MP Server." , name);
     SendClientMessage(playerid, -1, str);
     return 1;
}
In the above example the actual size required is: 58 (MAX_PLAYER_NAME+1 + String used in str = 25 + 33)

The corrected code should be:

pawn Код:
public OnPlayerConnect(playerid)
{
     new str[59],name[MAX_PLAYER_NAME+1]; // You can put 60 also. Not a big deal. But having 256 utilises lot of memory and it is too slow.
     GetPlayerName(playerid, name, sizeof(name));
     format(str,sizeof(str),"Hello %s , Welcome to SA-MP Server." , name);
     SendClientMessage(playerid, -1, str);
     return 1;
}
Reply


Messages In This Thread
Error compile. - by audriuxxx - 15.03.2013, 08:16
Re: Error compile. - by Vince - 15.03.2013, 08:22
Re: Error compile. - by LarzI - 15.03.2013, 08:54
Re: Error compile. - by Ballu Miaa - 15.03.2013, 09:35
Re: Error compile. - by audriuxxx - 15.03.2013, 11:15
Re: Error compile. - by audriuxxx - 15.03.2013, 11:30
Re: Error compile. - by LarzI - 15.03.2013, 11:47
Re: Error compile. - by Vince - 15.03.2013, 13:11
Re: Error compile. - by Konstantinos - 15.03.2013, 13:19
Re: Error compile. - by LarzI - 15.03.2013, 15:03

Forum Jump:


Users browsing this thread: 1 Guest(s)