some strings errors
#1

Got some errors at my dialogs, and some new things which is header size and the rest ...
my code

pawn Код:
if(dialogid == DIALOGID0+42)
    {
        if(response)
        {
            if(listitem == 0)
            {
                new string[128];
                if(PlayerInfo[playerid][LoggedIn] == 0)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this command");
                    return 1;
                }
                if(PlayerInfo[playerid][Jailed] == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this command");
                    return 1;
                }
                if(IsPlayerInAnyVehicle(playerid) == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be on foot in order to purchase 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],PlayerInfo[playerid][name],false) == 0)
                {
                    format(string, sizeof(string), "You already own this Business (%s)", BizInfo[ClosestBiz(playerid)][name]);
                    SendClientMessage(playerid, COLOR_BRIGHTRED, string);
                    return 1;
                }
                if(BizInfo[ClosestBiz(playerid)][bought] == 1)
                {
                    format(string, sizeof(string), "This Business (%s) is owned by %s, and is not for sale!", BizInfo[ClosestBiz(playerid)][name], BizInfo[ClosestBiz(playerid)][owner]);
                    SendClientMessage(playerid, COLOR_BRIGHTRED, string);
                    return 1;
                }
                if(PlayerInfo[playerid][bowner] == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You can only own ONE Business at a time! You must sell your other Business first!");
                    return 1;
                }
                new cash[MAX_PLAYERS];
                cash[playerid] = GetPlayerMoney(playerid);
                if(cash[playerid] >= BizInfo[ClosestBiz(playerid)][cost])
                {
                    new stringa[128];
                    strmid(BizInfo[ClosestBiz(playerid)][owner], PlayerInfo[playerid][name], 0, strlen(PlayerInfo[playerid][name]), 255);
                    BizInfo[ClosestBiz(playerid)][bought] = 1;
                    PlayerInfo[playerid][bowner] = 1;
                    PlayerInfo[playerid][bowned] = ClosestBiz(playerid);
                    GivePlayerMoney(playerid, -BizInfo[ClosestBiz(playerid)][cost]);
                    format(stringa, sizeof(stringa), "You just bought this Business (%s) for $%d. Your Business will earn you $%d/hr", BizInfo[ClosestBiz(playerid)][name], BizInfo[ClosestBiz(playerid)][cost],BizInfo[ClosestBiz(playerid)][profit]*2);
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, stringa);
                    new bizowner[30];
                    format(bizowner,128,"%s",BizInfo[ClosestBiz(playerid)][owner]);
                    if(strcmp(BizInfo[ClosestBiz(playerid)][owner],DEFAULT_OWNER,false) == 0)
                    {
                        format(bizowner,128,"Not Owned");
                    }
                    UpdateDynamic3DTextLabelText(bizTextInfo[ClosestBiz(playerid)],0xFF0000FF,bizowner);
                    new bId = ClosestBiz(playerid);
                    DestroyDynamicMapIcon(BizInfo[bId][ico]);
                    BizInfo[bId][ico] = CreateDynamicMapIcon(BizInfo[bId][xpos],BizInfo[bId][ypos],BizInfo[bId][zpos],32,250);
                    return 1;
                }
                if(cash[playerid] < BizInfo[ClosestBiz(playerid)][cost])
                {
                    format(string, sizeof(string), "You do not have $%d and cannot afford this Business (%s)!", BizInfo[ClosestBiz(playerid)][cost],BizInfo[ClosestBiz(playerid)][name]);
                    SendClientMessage(playerid, COLOR_BRIGHTRED, string);
                    return 1;
                }
            }
            if(listitem == 1)
            {
                if(PlayerInfo[playerid][LoggedIn] == 0)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this command");
                    return 1;
                }
                if(PlayerInfo[playerid][Jailed] == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this command");
                    return 1;
                }
                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(PlayerInfo[playerid][bowner] == 0)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You do not currently own any business!");
                    return 1;
                }
                if (strcmp(BizInfo[ClosestBiz(playerid)][owner],PlayerInfo[playerid][name],false) == 0)
                {
                    PlayerInfo[playerid][bowned] = 0;
                    PlayerInfo[playerid][bowner] = 0;
                    strmid(BizInfo[ClosestBiz(playerid)][owner], DEFAULT_OWNER, 0, strlen(DEFAULT_OWNER), 255);
                    BizInfo[ClosestBiz(playerid)][bought] = 0;
                    new cbmon = BizInfo[ClosestBiz(playerid)][cashbox],bmon = PlayerInfo[playerid][bank];
                    BizInfo[ClosestBiz(playerid)][cashbox] = 0;
                    PlayerInfo[playerid][bank] = cbmon+bmon;
                    GivePlayerMoney(playerid, BizInfo[ClosestBiz(playerid)][cost]);
                    new bsmsg[150];
                    format(bsmsg, sizeof(bsmsg), "You just sold your Business (%s) for $%d, the money that was in the cashbox ($%d) has been transferred to your bank account!!!", BizInfo[ClosestBiz(playerid)][name], BizInfo[ClosestBiz(playerid)][cost],cbmon);
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, bsmsg);
                    new bizowner[30];
                    format(bizowner,128,"%s",BizInfo[ClosestBiz(playerid)][owner]);
                    if(strcmp(BizInfo[ClosestBiz(playerid)][owner],DEFAULT_OWNER,false) == 0)
                    {
                        format(bizowner,128,"Not Owned");
                    }
                    UpdateDynamic3DTextLabelText(bizTextInfo[ClosestBiz(playerid)],0x00FF00FF,bizowner);
                    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
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "What are you trying to pull here, you don't own this Business!!!");
                    return 1;
                }
            }
            if(listitem == 2)
            {
                cmd_gotobiz(playerid,params);
            }
            if(listitem == 3)
            {
                new string[128];
                if(PlayerInfo[playerid][LoggedIn] == 0)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this command");
                    return 1;
                }
                if(PlayerInfo[playerid][Jailed] == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this command");
                    return 1;
                }
                if(IsPlayerInAnyVehicle(playerid) == 1)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be on foot in order to collect a business' earnings!");
                    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(PlayerInfo[playerid][bowner] == 0)
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You do not currently own any business!");
                    return 1;
                }
                if (strcmp(BizInfo[ClosestBiz(playerid)][owner],PlayerInfo[playerid][name],false) == 0)
                {
                    new cbmon = BizInfo[ClosestBiz(playerid)][cashbox],bmon = PlayerInfo[playerid][bank];
                    PlayerInfo[playerid][bank] = cbmon+bmon;
                    format(string, sizeof(string), "The earnings for your Business (%s - $%d), have been wired to your personal bank account!!!", BizInfo[ClosestBiz(playerid)][name], BizInfo[ClosestBiz(playerid)][cashbox]);
                    SendClientMessage(playerid, COLOR_GREEN, string);
                    BizInfo[ClosestBiz(playerid)][cashbox] = 0;
                    SavePlayer(playerid);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "What are you trying to pull here, you don't own this Business!!!");
                    return 1;
                }
            }
        }
        return 1;}
    if(dialogid == DIALOGID0+43)
    {
        if(response)
        {
            if(listitem == 0)
            {
                new string[128];
                if(PlayerInfo[playerid][LoggedIn] == 0) {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this command");
                    return 1;}
                if(PlayerInfo[playerid][Jailed] == 1) {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this command");
                    return 1;}
                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(string,sizeof(string),"This Business (%d) does not have an owner yet!",BizInfo[ClosestBiz(playerid)][name]);
                    SendClientMessage(playerid,COLOR_BRIGHTRED,string);
                    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(string, sizeof(string), "You just sold %s's Business (%s).", PlayerInfo[tempid[playerid]][name], BizInfo[ClosestBiz(playerid)][name]);
                        SendClientMessage(playerid, COLOR_ORANGE, string);
                        format(string, sizeof(string), "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, string);
                        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(BizInfo[ClosestBiz(playerid)][owner], ClosestBiz(playerid));
                    format(string, sizeof(string), "You just sold %s's Business (%s).", PlayerInfo[tempid[playerid]][name], BizInfo[ClosestBiz(playerid)][name]);
                    SendClientMessage(playerid, COLOR_ORANGE, string);
                    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;
                }
                if(!fexist(file))
                {
                    format(string, sizeof(string), "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_LIGHTGREEN, string);
                    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;
                }
            }
            if(listitem == 1)
            {
                cmd_resetallbusinesses(playerid,params);
            }
        }
        return 1;}
no need to show lines btw strings are showen right over there.

my errors

pawn Код:
warning 219: local variable "string" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          24024 bytes
Code size:          2650236 bytes
Data size:          5950696 bytes
Stack/heap size:    2227968 bytes; estimated max. usage: unknown, due to recursion
Total requirements:10852924 bytes

3 Warnings.
Reply
#2

pawn Код:
if(strcmp(BizInfo[ClosestBiz(playerid)][owner],PlayerInfo[playerid][name],false) == 0)
                {
                    new string[128];
                    format(string, sizeof(string), "You already own this Business (%s)", BizInfo[ClosestBiz(playerid)][name]);
                    SendClientMessage(playerid, COLOR_BRIGHTRED, string);
                    return 1;
                }
                if(BizInfo[ClosestBiz(playerid)][bought] == 1)
                {
                    new string[128];
                    format(string, sizeof(string), "This Business (%s) is owned by %s, and is not for sale!", BizInfo[ClosestBiz(playerid)][name], BizInfo[ClosestBiz(playerid)][owner]);
                    SendClientMessage(playerid, COLOR_BRIGHTRED, string);
                    return 1;
                }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)