stack\heap size
#1

hello guys i have a problem with my pawn compiler when i add this dialog
pawn Код:
if(dialogid == 7776)
    {
        if(response == 1)
        {
            if(listitem == 0)
            {
                if(IsPlayerAdmin(playerid))
                {
                    if(IsPlayerInAnyVehicle(playerid) == 1)
                    {
                        SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be on foot in order to sell a business!");
                        return 1;
                    }
                    if(ClosestBiz(playerid) >= 999)
                    {
                        SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not close enough to any of the current business icons to use this command");
                        return 1;
                    }
                    if (strcmp(BizInfo[ClosestBiz(playerid)][owner],DEFAULT_OWNER,false) == 0)
                    {
                        format(ystring,sizeof(ystring),"This Business (%d) does not have an owner yet!",BizInfo[ClosestBiz(playerid)][name]);
                        SendClientMessage(playerid,COLOR_BRIGHTRED,ystring);
                        return 1;
                    }
                    new file[256];
                    format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(BizInfo[ClosestBiz(playerid)][owner]));
                    if(fexist(file))
                    {
                        tempid[playerid] = IsPlayerNameOnline(BizInfo[ClosestBiz(playerid)][owner]);
                        if(tempid[playerid] >= 0 || tempid[playerid] <= MAX_PLAYERS)
                        {
                            strmid(BizInfo[ClosestBiz(playerid)][owner], DEFAULT_OWNER, 0, strlen(DEFAULT_OWNER), 255);
                            BizInfo[ClosestBiz(playerid)][bought] = 0;
                            BizInfo[ClosestBiz(playerid)][cashbox] = 0;
                            new cbmon = BizInfo[ClosestBiz(playerid)][cashbox],bmon = PlayerInfo[playerid][bank];
                            PlayerInfo[tempid[playerid]][bank] = cbmon+bmon;
                            PlayerInfo[tempid[playerid]][bowned] = 0;
                            PlayerInfo[tempid[playerid]][bowner] = 0;
                            format(ystring, sizeof(ystring), "You just sold %s's Business (%s).", PlayerInfo[tempid[playerid]][name], BizInfo[ClosestBiz(playerid)][name]);
                            SendClientMessage(playerid, COLOR_ORANGE, ystring);
                            format(ystring, sizeof(ystring), "Admin (%s) has just sold your Business (%s)! Your cashbox money was sent to your personal bank account", PlayerInfo[playerid][name],BizInfo[ClosestBiz(playerid)][name]);
                            SendClientMessage(tempid[playerid], COLOR_ORANGE, ystring);
                            new bId = ClosestBiz(playerid);
                            DestroyDynamicMapIcon(BizInfo[bId][ico]);
                            BizInfo[bId][ico] = CreateDynamicMapIcon(BizInfo[bId][xpos],BizInfo[bId][ypos],BizInfo[bId][zpos],31,250);
                            return 1;
                        }
                        else
                        {
                            ResetOfflinePlayerFileB(file, ClosestBiz(playerid));
                            format(ystring, sizeof(ystring), "You just sold %s's Business (%s).", PlayerInfo[tempid[playerid]][name], BizInfo[ClosestBiz(playerid)][name]);
                            SendClientMessage(playerid, COLOR_ORANGE, ystring);
                            return 1;
                        }
                    }
                    if(!fexist(file))
                    {
                        format(ystring, sizeof(ystring), "You just sold %s's Business (%s). The player file was not found and cannot be altered.", PlayerInfo[tempid[playerid]][name], BizInfo[ClosestBiz(playerid)][name]);
                        SendClientMessage(playerid, COLOR_GREEN, ystring);
                        strmid(BizInfo[ClosestBiz(playerid)][owner], DEFAULT_OWNER, 0, strlen(DEFAULT_OWNER), 255);
                        BizInfo[ClosestBiz(playerid)][bought] = 0;
                        BizInfo[ClosestBiz(playerid)][cashbox] = 0;
                        new bId = ClosestBiz(playerid);
                        DestroyDynamicMapIcon(BizInfo[bId][ico]);
                        BizInfo[bId][ico] = CreateDynamicMapIcon(BizInfo[bId][xpos],BizInfo[bId][ypos],BizInfo[bId][zpos],31,250);
                        return 1;
                    }
                }
                else return ShowPlayerDialog(playerid, 90321, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - ERROR MSG", RconMSG,"OK","");
            }
            if(listitem == 1)
            {
                if(IsPlayerAdmin(playerid))
                {
                    aresetallbiz();
                    fremove(B_FILE_SAVE);
                    LoadBusinesses();
                    SendClientMessageToAll(COLOR_ORANGE, "All Businesses Have Been Reset.");
                }
                else return ShowPlayerDialog(playerid, 90321, DIALOG_STYLE_MSGBOX, "{FF0000}SFTDM - ERROR MSG", RconMSG,"OK","");
            }
        }
    }
i get this
pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          20820 bytes
Code size:          1631888 bytes
Data size:          6786800 bytes
Stack/heap size:    2227968 bytes; estimated max. usage: unknown, due to recursion
Total requirements:10667476 bytes
so i am wondering if there is any problem in the dialog above thanks in advance
Reply
#2

Optimize your whole script and that shouldn't happen anymore
Reply
#3

if i used the word optimize the way u mean that means the error is in the code above, cause i replaced all of my gm strings with a public string!
Reply
#4

You have an error in your script. try running it on localhost and see if you don't get a spamming message in your console.
Reply
#5

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
You have an error in your script. try running it on localhost and see if you don't get a spamming message in your console.
do you mean my whole script or the script i posted above and what is the difference between my web host or my localhost? explain your idea please!
Reply
#6

There's no need to do anything, you should be fine unless you get an error in the console.

If you would like that extra table to just not show overall, you could put "#pragma dynamic (and a value here)" on the top of your script.

https://sampwiki.blast.hk/wiki/Keywords...ives#.23pragma
Reply
#7

Intend the code provided above and it'll be fine.
Reply
#8

While that stack size is perfectly fine, you made a terrible mistake creating a global string for all your local ones, not only it opens up for random wrong messages sometimes (unless you empty the global string in every local case, but also there is a reason local variables were designed this way, it is a great concept and should be used.
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
There's no need to do anything, you should be fine unless you get an error in the console.

If you would like that extra table to just not show overall, you could put "#pragma dynamic (and a value here)" on the top of your script.

https://sampwiki.blast.hk/wiki/Keywords...ives#.23pragma
That's just a stupid workaround for lazy people. If you don't use stupidly large local arrays then that message won't show up. For example, there's no reason for the "file" array to be 256 characters long when the string it will contain will be at most some 60 characters in length; 75% wasted.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)