Optimization
#1

Can someone tell me is this good
PHP код:
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
Header size
:           22028 bytes
Code size
:           6437984 bytes
Data size
:          23484496 bytes
Stack
/heap size:       16384 bytesestimated maxusageunknowndue to recursion
Total requirements
29960892 bytes 
I don't understand this very good so i have no idea what does this mean xD. I wanted to ask you should these numbers go lower or higher? And if lower tell me how
Reply
#2

I'm sure someone else can explain what this exactly means, but the way to have that information disappear is one of two things.

One, you can put this somewhere near the time of your script (like after includes maybe)

Код:
#pragma dynamic 1000000
Two, you can go through the script and optimize it. Look for things like how to simplify code, reduce string sizes if they are unreasonable large, etc.

I'd go with the second option as it's much better practice. I'm not sure if this is a good analogy but imagine

Код:
Header size:           22028 bytes 
Code size:           6437984 bytes 
Data size:          23484496 bytes 
Stack/heap size:       16384 bytes; estimated max. usage: unknown, due to recursion 
Total requirements: 29960892 bytes
^ this being your room after it's gotten dirty. The first option would be like shoving most, if not all, of the garbage and junk under your bed while the second option is actually cleaning the room up. Hope this helps you understand it a little bit better :P
Reply
#3

I do understand it and I am working on optimizing this code for days. This is not my GM I am just editing it.

Could problem be SCMF and globalstring[128] ??

I am also fixing those local strings too

EIDT:That globalstring[128] is defined on the top of GM
Reply
#4

I'm not sure what SCMF is, so I'm not sure. As for the globalstring, it really depends on what the string is being used for throughout the script. I'm not saying removing it would remove that msg upon compiling, but it could contribute to it.
Reply
#5

Well globalstring is used very much trough GM

And about SCMF

http://ysi.wikia.com/wiki/Library:YSI/y_va

this #inlcude <YSI\y_va>

I think it is eating memory..
Reply
#6

Is there anything else in the script that requires the use of that include? Also, could you provide examples of where the globalstring is used?
Reply
#7

PHP код:
SCMF(playeridcolourformat[], va_args<>)
{
    new 
out[384];
    
va_format(outsizeof (out), formatva_start<3>);
    
SCM(playeridcolourout);
    return 
1;

If i remove y_va include i get error on code above. If i remove code above i get error in gamemode because SCMF is not defined. So i need to check line by line and to format strings

Global string is used here
PHP код:
CMD:server(playeridparams[])
{
       new 
adminCmdsList[1080];
    
strdel(adminCmdsList0sizeof(adminCmdsList));
    
format(globalstringsizeof(globalstring), "\n"SERVERPLAVA"Ukupno posjeta: %d\n"ServerS[sVisits]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Ukupno logina: %d\n"ServerS[sLogins]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Registrovanih accounta: %d\n"ServerS[sUsers]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Banovanih igraca: %d\n"ServerS[sBans]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Odbanovanih igraca: %d\n"ServerS[sUnbans]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Kikovanih igraca: %d\n"ServerS[sKicks]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Upozorenih igraca: %d\n"ServerS[sWarns]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Name-ovanih igraca: %d\n"ServerS[sNames]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Pokrenuto eventa: %d\n"ServerS[sEvents]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Ukupno chrasheva: %d\n"ServerS[sCrashes]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Ukupno smrti: %d\n"ServerS[sDeaths]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Unistenih vozila: %d\n"ServerS[sCarsDestroyed]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Ukupno payday-ova: %d\n"ServerS[sPayDays]);
    
strcat(adminCmdsListglobalstring);
    
format(globalstringsizeof(globalstring), ""SERVERPLAVA"Ukupno restarta: %d\n\n"ServerS[sRestarts]);
    
strcat(adminCmdsListglobalstring);
    
SPD(playerid6666DIALOG_STYLE_MSGBOX""SERVERPLAVA"Server statistika\n"adminCmdsList"Uredu""");
    return 
1;
}
CMD:sviclanovi(playeridparams[])
{
    if(
PlayerInfo[playerid][pLider] == 0) return GRESKA(playerid,"Samo Lideri!");
    if(
PlayerInfo[playerid][pLider] == 1)
    {
        
SCM(playerid, -1"{FFFF80}________________| Los Santos Police Department |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LSPDInfo[1][lspdLider], LSPDInfo[2][lspdLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
LSPDInfo[1][lspdMjesto], LSPDInfo[2][lspdMjesto], LSPDInfo[3][lspdMjesto], LSPDInfo[4][lspdMjesto], LSPDInfo[5][lspdMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
LSPDInfo[6][lspdMjesto], LSPDInfo[7][lspdMjesto], LSPDInfo[8][lspdMjesto], LSPDInfo[9][lspdMjesto], LSPDInfo[10][lspdMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
LSPDInfo[11][lspdMjesto], LSPDInfo[12][lspdMjesto], LSPDInfo[13][lspdMjesto], LSPDInfo[14][lspdMjesto], LSPDInfo[15][lspdMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
LSPDInfo[16][lspdMjesto], LSPDInfo[17][lspdMjesto], LSPDInfo[18][lspdMjesto], LSPDInfo[19][lspdMjesto], LSPDInfo[20][lspdMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 3)
    {
        
SCM(playerid, -1"{FFFF80}________________| Yakuza |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"YInfo[1][yakuzaLider], YInfo[2][yakuzaLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
YInfo[1][yakuzaMjesto], YInfo[2][yakuzaMjesto], YInfo[3][yakuzaMjesto], YInfo[4][yakuzaMjesto], YInfo[5][yakuzaMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
YInfo[6][yakuzaMjesto], YInfo[7][yakuzaMjesto], YInfo[8][yakuzaMjesto], YInfo[9][yakuzaMjesto], YInfo[10][yakuzaMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
YInfo[11][yakuzaMjesto], YInfo[12][yakuzaMjesto], YInfo[13][yakuzaMjesto], YInfo[14][yakuzaMjesto], YInfo[15][yakuzaMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
YInfo[16][yakuzaMjesto], YInfo[17][yakuzaMjesto], YInfo[18][yakuzaMjesto], YInfo[19][yakuzaMjesto], YInfo[20][yakuzaMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 4)
    {
        
SCM(playerid, -1"{FFFF80}________________| Grove Street Family |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"GSFInfo[1][gsfLider], GSFInfo[2][gsfLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
GSFInfo[1][gsfMjesto], GSFInfo[2][gsfMjesto], GSFInfo[3][gsfMjesto], GSFInfo[4][gsfMjesto], GSFInfo[5][gsfMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
GSFInfo[6][gsfMjesto], GSFInfo[7][gsfMjesto], GSFInfo[8][gsfMjesto], GSFInfo[9][gsfMjesto], GSFInfo[10][gsfMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
GSFInfo[11][gsfMjesto], GSFInfo[12][gsfMjesto], GSFInfo[13][gsfMjesto], GSFInfo[14][gsfMjesto], GSFInfo[15][gsfMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
GSFInfo[16][gsfMjesto], GSFInfo[17][gsfMjesto], GSFInfo[18][gsfMjesto], GSFInfo[19][gsfMjesto], GSFInfo[20][gsfMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 5)
    {
        
SCM(playerid, -1"{FFFF80}________________| Ballas Family |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"BInfo[1][bsLider], BInfo[2][bsLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
BInfo[1][bsMjesto], BInfo[2][bsMjesto], BInfo[3][bsMjesto], BInfo[4][bsMjesto], BInfo[5][bsMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
BInfo[6][bsMjesto], BInfo[7][bsMjesto], BInfo[8][bsMjesto], BInfo[9][bsMjesto], BInfo[10][bsMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
BInfo[11][bsMjesto], BInfo[12][bsMjesto], BInfo[13][bsMjesto], BInfo[14][bsMjesto], BInfo[15][bsMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
BInfo[16][bsMjesto], BInfo[17][bsMjesto], BInfo[18][bsMjesto], BInfo[19][bsMjesto], BInfo[20][bsMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 6)
    {
        
SCM(playerid, -1"{FFFF80}________________| Los Santos Novinari |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"NInfo[1][nLider], NInfo[2][nLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
NInfo[1][nMjesto], NInfo[2][nMjesto], NInfo[3][nMjesto], NInfo[4][nMjesto], NInfo[5][nMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
NInfo[6][nMjesto], NInfo[7][nMjesto], NInfo[8][nMjesto], NInfo[9][nMjesto], NInfo[10][nMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
NInfo[11][nMjesto], NInfo[12][nMjesto], NInfo[13][nMjesto], NInfo[14][nMjesto], NInfo[15][nMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
NInfo[16][nMjesto], NInfo[17][nMjesto], NInfo[18][nMjesto], NInfo[19][nMjesto], NInfo[20][nMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 9)
    {
        
SCM(playerid, -1"{FFFF80}________________| La Cocaina |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LCInfo[1][lcLider], LCInfo[2][lcLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
LCInfo[1][lcMjesto], LCInfo[2][lcMjesto], LCInfo[3][lcMjesto], LCInfo[4][lcMjesto], LCInfo[5][lcMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
LCInfo[6][lcMjesto], LCInfo[7][lcMjesto], LCInfo[8][lcMjesto], LCInfo[9][lcMjesto], LCInfo[10][lcMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
LCInfo[11][lcMjesto], LCInfo[12][lcMjesto], LCInfo[13][lcMjesto], LCInfo[14][lcMjesto], LCInfo[15][lcMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
LCInfo[16][lcMjesto], LCInfo[17][lcMjesto], LCInfo[18][lcMjesto], LCInfo[19][lcMjesto], LCInfo[20][lcMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 11)
    {
        
SCM(playerid, -1"{FFFF80}________________| La Cosa Nostra |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LCNInfo[1][lcnLider], LCNInfo[2][lcnLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
LCNInfo[1][lcnMjesto], LCNInfo[2][lcnMjesto], LCNInfo[3][lcnMjesto], LCNInfo[4][lcnMjesto], LCNInfo[5][lcnMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
LCNInfo[6][lcnMjesto], LCNInfo[7][lcnMjesto], LCNInfo[8][lcnMjesto], LCNInfo[9][lcnMjesto], LCNInfo[10][lcnMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
LCNInfo[11][lcnMjesto], LCNInfo[12][lcnMjesto], LCNInfo[13][lcnMjesto], LCNInfo[14][lcnMjesto], LCNInfo[15][lcnMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
LCNInfo[16][lcnMjesto], LCNInfo[17][lcnMjesto], LCNInfo[18][lcnMjesto], LCNInfo[19][lcnMjesto], LCNInfo[20][lcnMjesto]);
        
SCM(playerid, -1globalstring);
    }
    else if(
PlayerInfo[playerid][pLider] == 16)
    {
        
SCM(playerid, -1"{FFFF80}________________| Hitman Agency |________________");
        
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"HAInfo[1][haLider], HAInfo[2][haLider]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
        
HAInfo[1][haMjesto], HAInfo[2][haMjesto], HAInfo[3][haMjesto], HAInfo[4][haMjesto], HAInfo[5][haMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
        
HAInfo[6][haMjesto], HAInfo[7][haMjesto], HAInfo[8][haMjesto], HAInfo[9][haMjesto], HAInfo[10][haMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
        
HAInfo[11][haMjesto], HAInfo[12][haMjesto], HAInfo[13][haMjesto], HAInfo[14][haMjesto], HAInfo[15][haMjesto]);
        
SCM(playerid, -1globalstring);
        
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
        
HAInfo[16][haMjesto], HAInfo[17][haMjesto], HAInfo[18][haMjesto], HAInfo[19][haMjesto], HAInfo[20][haMjesto]);
        
SCM(playerid, -1globalstring);
    }
    return 
1;
}
///////////////////////////////////////////////////////
CMD:izbaci(playeridparams[])
{
    if(
PlayerInfo[playerid][pLider] == 0) return GRESKA(playerid,"Samo Lideri!");
    new 
broj;
    if(
sscanf(params"i"broj))
    {
        if(
PlayerInfo[playerid][pLider] == 1)
        {
               
SCM(playerid, -1"{FFFF80}________________| Los Santos Police Department |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LSPDInfo[1][lspdLider], LSPDInfo[2][lspdLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
LSPDInfo[1][lspdMjesto], LSPDInfo[2][lspdMjesto], LSPDInfo[3][lspdMjesto], LSPDInfo[4][lspdMjesto], LSPDInfo[5][lspdMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
LSPDInfo[6][lspdMjesto], LSPDInfo[7][lspdMjesto], LSPDInfo[8][lspdMjesto], LSPDInfo[9][lspdMjesto], LSPDInfo[10][lspdMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
LSPDInfo[11][lspdMjesto], LSPDInfo[12][lspdMjesto], LSPDInfo[13][lspdMjesto], LSPDInfo[14][lspdMjesto], LSPDInfo[15][lspdMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
LSPDInfo[16][lspdMjesto], LSPDInfo[17][lspdMjesto], LSPDInfo[18][lspdMjesto], LSPDInfo[19][lspdMjesto], LSPDInfo[20][lspdMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 3)
        {
            
SCM(playerid, -1"{FFFF80}________________| Yakuza |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"YInfo[1][yakuzaLider], YInfo[2][yakuzaLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
YInfo[1][yakuzaMjesto], YInfo[2][yakuzaMjesto], YInfo[3][yakuzaMjesto], YInfo[4][yakuzaMjesto], YInfo[5][yakuzaMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
YInfo[6][yakuzaMjesto], YInfo[7][yakuzaMjesto], YInfo[8][yakuzaMjesto], YInfo[9][yakuzaMjesto], YInfo[10][yakuzaMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
YInfo[11][yakuzaMjesto], YInfo[12][yakuzaMjesto], YInfo[13][yakuzaMjesto], YInfo[14][yakuzaMjesto], YInfo[15][yakuzaMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
YInfo[16][yakuzaMjesto], YInfo[17][yakuzaMjesto], YInfo[18][yakuzaMjesto], YInfo[19][yakuzaMjesto], YInfo[20][yakuzaMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 4)
        {
            
SCM(playerid, -1"{FFFF80}________________| Grove Street Family |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"GSFInfo[1][gsfLider], GSFInfo[2][gsfLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
GSFInfo[1][gsfMjesto], GSFInfo[2][gsfMjesto], GSFInfo[3][gsfMjesto], GSFInfo[4][gsfMjesto], GSFInfo[5][gsfMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
GSFInfo[6][gsfMjesto], GSFInfo[7][gsfMjesto], GSFInfo[8][gsfMjesto], GSFInfo[9][gsfMjesto], GSFInfo[10][gsfMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
GSFInfo[11][gsfMjesto], GSFInfo[12][gsfMjesto], GSFInfo[13][gsfMjesto], GSFInfo[14][gsfMjesto], GSFInfo[15][gsfMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
GSFInfo[16][gsfMjesto], GSFInfo[17][gsfMjesto], GSFInfo[18][gsfMjesto], GSFInfo[19][gsfMjesto], GSFInfo[20][gsfMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 5)
        {
            
SCM(playerid, -1"{FFFF80}________________| Ballas Family |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"BInfo[1][bsLider], BInfo[2][bsLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
BInfo[1][bsMjesto], BInfo[2][bsMjesto], BInfo[3][bsMjesto], BInfo[4][bsMjesto], BInfo[5][bsMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
BInfo[6][bsMjesto], BInfo[7][bsMjesto], BInfo[8][bsMjesto], BInfo[9][bsMjesto], BInfo[10][bsMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
BInfo[11][bsMjesto], BInfo[12][bsMjesto], BInfo[13][bsMjesto], BInfo[14][bsMjesto], BInfo[15][bsMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
BInfo[16][bsMjesto], BInfo[17][bsMjesto], BInfo[18][bsMjesto], BInfo[19][bsMjesto], BInfo[20][bsMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 6)
        {
            
SCM(playerid, -1"{FFFF80}________________| Los Santos Novinari |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"NInfo[1][nLider], NInfo[2][nLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
NInfo[1][nMjesto], NInfo[2][nMjesto], NInfo[3][nMjesto], NInfo[4][nMjesto], NInfo[5][nMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
NInfo[6][nMjesto], NInfo[7][nMjesto], NInfo[8][nMjesto], NInfo[9][nMjesto], NInfo[10][nMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
NInfo[11][nMjesto], NInfo[12][nMjesto], NInfo[13][nMjesto], NInfo[14][nMjesto], NInfo[15][nMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
NInfo[16][nMjesto], NInfo[17][nMjesto], NInfo[18][nMjesto], NInfo[19][nMjesto], NInfo[20][nMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 9)
        {
            
SCM(playerid, -1"{FFFF80}________________| La Cocaina |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LCInfo[1][lcLider], LCInfo[2][lcLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
LCInfo[1][lcMjesto], LCInfo[2][lcMjesto], LCInfo[3][lcMjesto], LCInfo[4][lcMjesto], LCInfo[5][lcMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
LCInfo[6][lcMjesto], LCInfo[7][lcMjesto], LCInfo[8][lcMjesto], LCInfo[9][lcMjesto], LCInfo[10][lcMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
LCInfo[11][lcMjesto], LCInfo[12][lcMjesto], LCInfo[13][lcMjesto], LCInfo[14][lcMjesto], LCInfo[15][lcMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
LCInfo[16][lcMjesto], LCInfo[17][lcMjesto], LCInfo[18][lcMjesto], LCInfo[19][lcMjesto], LCInfo[20][lcMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 11)
        {
            
SCM(playerid, -1"{FFFF80}________________| La Cosa Nostra |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"LCNInfo[1][lcnLider], LCNInfo[2][lcnLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
LCNInfo[1][lcnMjesto], LCNInfo[2][lcnMjesto], LCNInfo[3][lcnMjesto], LCNInfo[4][lcnMjesto], LCNInfo[5][lcnMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
LCNInfo[6][lcnMjesto], LCNInfo[7][lcnMjesto], LCNInfo[8][lcnMjesto], LCNInfo[9][lcnMjesto], LCNInfo[10][lcnMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
LCNInfo[11][lcnMjesto], LCNInfo[12][lcnMjesto], LCNInfo[13][lcnMjesto], LCNInfo[14][lcnMjesto], LCNInfo[15][lcnMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
LCNInfo[16][lcnMjesto], LCNInfo[17][lcnMjesto], LCNInfo[18][lcnMjesto], LCNInfo[19][lcnMjesto], LCNInfo[20][lcnMjesto]);
            
SCM(playerid, -1globalstring);
        }
        else if(
PlayerInfo[playerid][pLider] == 16)
        {
            
SCM(playerid, -1"{FFFF80}________________| Hitman Agency |________________");
            
format(globalstringsizeof globalstring"Lider 1: %s | Lider 2: %s"HAInfo[1][haLider], HAInfo[2][haLider]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            
HAInfo[1][haMjesto], HAInfo[2][haMjesto], HAInfo[3][haMjesto], HAInfo[4][haMjesto], HAInfo[5][haMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"6: %s | 7: %s | 8: %s | 9: %s | 10: %s",
            
HAInfo[6][haMjesto], HAInfo[7][haMjesto], HAInfo[8][haMjesto], HAInfo[9][haMjesto], HAInfo[10][haMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"11: %s | 12: %s | 13: %s | 14: %s | 15: %s",
            
HAInfo[11][haMjesto], HAInfo[12][haMjesto], HAInfo[13][haMjesto], HAInfo[14][haMjesto], HAInfo[15][haMjesto]);
            
SCM(playerid, -1globalstring);
            
format(globalstringsizeof globalstring"16: %s | 17: %s | 18: %s | 19: %s | 20: %s",
            
HAInfo[16][haMjesto], HAInfo[17][haMjesto], HAInfo[18][haMjesto], HAInfo[19][haMjesto], HAInfo[20][haMjesto]);
            
SCM(playerid, -1globalstring);
        }
        return 
1;
    } 
Those are jsut biggest commands. It is used in almost every command. This is RP gamemode so imagine that..
Reply
#8

Why not making it local into cmd Global strings stay from gminit to gmexit... While local are called when cmd is called and deleted when cmd is done.

About "used everywhere" usually people use "string[128]" a lot, but most of the times its local
Reply
#9

You don't understand. This is not my GM I am just editing it. I was asking what should I do about optimization of this GM because look at this
PHP код:
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 

Header size
:           22028 bytes 
Code size
:           6437984 bytes 
Data size
:          23484496 bytes 
Stack
/heap size:       16384 bytesestimated maxusageunknowndue to recursion 
Total requirements
29960892 bytes 
Reply
#10

Use foreach instead of for loop.
Use switch statements instead of if statements.
Reduce your string sizes.
Don't create 2 string variables if you need one for 2 messages.
Check out your arrays. They might have bigger size that what it needs.
Check if your global variables are actually necessary as global. You may need to use them only locally in some commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)