I always wonder what affect to this "information" and why it show on compile?
#1

I saw this on all filterscripts, and also on some gamemodes:
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
But on some gamemodes, this "information" is also displayed:
Код:
Header size:
Code size:
Data size:
Stack/heap size:
Total requirements:
I always woder to know what affect to this "debug-information" show and why its shown?
Reply
#2

I believe this is caused by the usage of large strings in your mode.

For example, you shouldn't have things like this:

pawn Код:
new string[256];
When you don't need a 256-cell string! EDIT: ****** made a very good topic about this.

Or, this:

pawn Код:
new string[7000];
That is just an outrageous string size and unnecessary to be honest. You would be better off making a smaller string and just executing what you need it for a few times. For example, I have seen people with HUGE SQL queries and they're stuffing it all into a single string. It's easier to split it up and run mysql_query() a few times, rather than a single time.

Most GF edits have this problem, due to the first example I gave you.
Reply
#3

Yep, you're right. I just edit some strings to abnormal high value and exactly - i get these infos (in another gamemode, just to test this)

I putting things in one gamemode and at some time i get that "info" when compiled. I dont know why affected this, but now i wish edit that, but its on old RolePlay mode which i dont used for two years... I dont remind what i put when this displayed, but if its just about strings, i will edit all strings to 128? Or?

Btw, can I ask if this work?
pawn Код:
OnPlayerDisconnect:
    if(IsPlayerLoggedIn(playerid)) {SaveChar(playerid);}
Or i must put it like this:

pawn Код:
OnPlayerDisconnect:
SaveChar(playerid);
Reply
#4

To call code inside the OnPlayerDisconnect callback, it would have to be like this:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   if(IsPlayerLoggedIn(playerid)) SaveChar(playerid);
   return 1;
}
Otherwise, this would work too:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   SaveChar(playerid);
   return 1;
}
Reply
#5

Ok, so IsPlayerConnected work in OnPlayerDisconnect? I think its unnecessary?


I wish to lower the ammount of unnecessary big strings. But if i need string with more than 128, assuming 2000? It will work without that "debug-info" or?
Reply
#6

The code above isn't checking to see if they are only connected to the server, it is also seeing if they have logged into an account and need to have some data saved or not! So no, it isn't unnecessary.

In regards to the big strings, I have used 2000 in the past w/o issues, but I would strongly advise against it!
Reply
#7

Okay, thanks. I didnt know that IsPlayerConnected will work in OnPlayerDisconnect (because he is leaving).

I must use 500, 1000 and sometimes 2000 for dialogs. I dont know will they show "debug-info" which indicates too many strings? Or it just shown when i use big string when unnecessary?
Reply
#8

Quote:
Originally Posted by Tommy_Diaz
Посмотреть сообщение
I dont know will they show "debug-info" which indicates too many strings? Or it just shown when i use big string when unnecessary?
I'm not 100% certain for the answer to that question. Honestly, as you continue writing your mode, try to take time and figure out exactly how many cells you need per string. You can use a program like Microsoft Office Word to check how many characters are in the string. So, if you have 313 characters in the string, add 1 (for the null terminator), and you only need to have a 314-cell string.

When you use format() to handle things like %s (for a player name), account for %s becoming 25 characters at one point because 25 is the max player name size.

Hopefully that makes sense.

For additional information on choosing good string sizes, review this topic: https://sampforum.blast.hk/showthread.php?tid=55261
Reply
#9

For text-defines - no problem, i saw and read that topic long time ago.
But, dialogs is the problem. Also, "private-message" text is sometime not enough to fit into 128 string, so i set string 200 for that. Dialogs and formating another big things is the problem, because i cant calculate how much i need (it depend on online-users, etc). Also for the car-spawn dialog list etc...

And, is using a big strings a huge problem?
Reply
#10

I wouldn't say it's a huge problem, no. You should be okay using a few larger-strings here and there. It's just a bad coding practice IMHO, but you have to do what you have to do!

You mentioned PM's being longer than 128 characters... Keep in mind that the text-area can only support a total of 128 characters per each time you use SendClientMessage(). So, supporting 200 cells is useless as 72 cells would never be used.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)