Biz System bug
#1

So I have a business system which is really bugged.The text and the pickup doesn't show and when I do /bizedit exterior/interior/price 0 It says Unknown command.I really need your help and would be really happy if this gets solved

Code:
pawn Код:
CMD:bizedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
        return 1;
    }

    new string[128], choice[32], bizid, amount, businesstype[128];
    if(sscanf(params, "s[32]dD", choice, bizid, amount))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bizedit [name] [bizid] [(Optional)amount]");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, Level, Type, Price");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Prods, Locked");
        return 1;
    }

    if(strcmp(choice, "interior", true) == 0)
    {
        BizzInfo[bizid][bInteriorID] = GetPlayerInterior( playerid );
        GetPlayerPos( playerid, BizzInfo[bizid][bExitX], BizzInfo[bizid][bExitY], BizzInfo[bizid][bExitZ]);
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
        SaveBizz();

        format(string, sizeof(string), "%s has edited BizID %d's Interior.", GetPlayerNameEx(playerid), bizid);
        Log("logs/bedit.log", string);
        return 1;
    }
    else if(strcmp(choice, "exterior", true) == 0)
    {
        GetPlayerPos( playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
        DestroyDynamicPickup(BizzInfo[bizid][bPickupID]);
        //BizzInfo[bizid][bLocked] = 1;

        format(string, sizeof(string), "%s has edited BizID %d's Exterior.", GetPlayerNameEx(playerid), bizid);
        Log("logs/bedit.log", string);
        SaveBizz();
        if(BizzInfo[bizid][bOwned] == 1)
        {
            DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
            BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
            format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
            BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
            //Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        }
        else
        {
            DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
            BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
            //Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        }
    }
    else if(strcmp(choice, "level", true) == 0)
    {
        BizzInfo[bizid][bLevelNeeded] = amount;
        format(string, sizeof(string), "You have set the house level to %d.", amount);
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizzInfo[bizid][bOwned] == 0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }
        else
        {
            format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }
        format(string, sizeof(string), "%s has edited BizID %d's Level to %d.", GetPlayerNameEx(playerid), bizid, amount);
        Log("logs/bedit.log", string);
    }
    else if(strcmp(choice, "price", true) == 0)
    {
        BizzInfo[bizid][bBuyPrice] = amount;
        format(string, sizeof(string), "You have set the biz price to $%d.", amount );
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizzInfo[bizid][bOwned] == 0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }

        format(string, sizeof(string), "%s has edited BizID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
        Log("logs/bedit.log", string);
    }
    else if(strcmp(choice, "type", true) == 0)
    {
        switch(amount)
        {
        case 1:
            {
                businesstype = "24-7";
                BizzInfo[bizid][bType] = 1;
            }
        case 2:
            {
                 businesstype = "Bank";
                 BizzInfo[bizid][bType] = 2;
            }
        case 3:
            {
                businesstype = "Club";
                BizzInfo[bizid][bType] = 3;
            }
        case 4:
            {
                businesstype = "Ammunation";
                BizzInfo[bizid][bType] = 4;
            }
        case 5:
            {
                businesstype = "Casino";
                BizzInfo[bizid][bType] = 5;
            }
        case 6:
            {
                businesstype = "Restaurant";
                BizzInfo[bizid][bType] = 6;
            }
        }
        if(BizzInfo[bizid][bOwned] ==0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }

        format(string, sizeof(string), "%s has edited BizID %d's Type to %d.", GetPlayerNameEx(playerid), bizid, amount);
        Log("logs/bedit.log", string);
    }
    SaveBizz();
    return 1;
}
Reply
#2

Bump, help please
Reply
#3

its verry messy.
the first condition check break the code which then it will not reach the SaveBizz();

for the other stuff why dont you debug before coming here ?

use print("");
see what gets called what not
Reply
#4

If it's doing that it's likely that your referencing an out of bounds array use the crash detect plugin. Your not even checking your user input for validity apart from seeing if the user actually supplied values.

pawn Код:
if(sscanf(params, "s[32]dD", choice, bizid, amount))
But you also need to check if bizid and amount are valid.
Reply
#5

Quote:
Originally Posted by Necip
Посмотреть сообщение
So I have a business system which is really bugged.The text and the pickup doesn't show and when I do /bizedit exterior/interior/price 0 It says Unknown command.I really need your help and would be really happy if this gets solved

Code:
pawn Код:
CMD:bizedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
        return 1;
    }

    new string[128], choice[32], bizid, amount, businesstype[128];
    if(sscanf(params, "s[32]dD", choice, bizid, amount))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bizedit [name] [bizid] [(Optional)amount]");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, Level, Type, Price");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Prods, Locked");
        return 1;
    }

    if(strcmp(choice, "interior", true) == 0)
    {
        BizzInfo[bizid][bInteriorID] = GetPlayerInterior( playerid );
        GetPlayerPos( playerid, BizzInfo[bizid][bExitX], BizzInfo[bizid][bExitY], BizzInfo[bizid][bExitZ]);
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
        SaveBizz();

        format(string, sizeof(string), "%s has edited BizID %d's Interior.", GetPlayerNameEx(playerid), bizid);
        Log("logs/bedit.log", string);
        return 1;
    }
    else if(strcmp(choice, "exterior", true) == 0)
    {
        GetPlayerPos( playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
        DestroyDynamicPickup(BizzInfo[bizid][bPickupID]);
        //BizzInfo[bizid][bLocked] = 1;

        format(string, sizeof(string), "%s has edited BizID %d's Exterior.", GetPlayerNameEx(playerid), bizid);
        Log("logs/bedit.log", string);
        SaveBizz();
        if(BizzInfo[bizid][bOwned] == 1)
        {
            DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
            BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
            format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
            BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
            //Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        }
        else
        {
            DestroyDynamic3DTextLabel(BizzInfo[bizid][bTextID]);
            BizzInfo[bizid][bPickupID] = CreateDynamicPickup(1274, 23, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ], 0, -1, -1, 150.0 );
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            BizzInfo[bizid][bTextID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
            //Streamer_UpdateEx(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
        }
    }
    else if(strcmp(choice, "level", true) == 0)
    {
        BizzInfo[bizid][bLevelNeeded] = amount;
        format(string, sizeof(string), "You have set the house level to %d.", amount);
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizzInfo[bizid][bOwned] == 0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }
        else
        {
            format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nOwner: %s\n%s\nEntrance Fee: $%d\nID: %d", BizzInfo[bizid][bOwner], BizzInfo[bizid][bMessage],BizzInfo[bizid][bEntranceCost], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }
        format(string, sizeof(string), "%s has edited BizID %d's Level to %d.", GetPlayerNameEx(playerid), bizid, amount);
        Log("logs/bedit.log", string);
    }
    else if(strcmp(choice, "price", true) == 0)
    {
        BizzInfo[bizid][bBuyPrice] = amount;
        format(string, sizeof(string), "You have set the biz price to $%d.", amount );
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizzInfo[bizid][bOwned] == 0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }

        format(string, sizeof(string), "%s has edited BizID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
        Log("logs/bedit.log", string);
    }
    else if(strcmp(choice, "type", true) == 0)
    {
        switch(amount)
        {
        case 1:
            {
                businesstype = "24-7";
                BizzInfo[bizid][bType] = 1;
            }
        case 2:
            {
                 businesstype = "Bank";
                 BizzInfo[bizid][bType] = 2;
            }
        case 3:
            {
                businesstype = "Club";
                BizzInfo[bizid][bType] = 3;
            }
        case 4:
            {
                businesstype = "Ammunation";
                BizzInfo[bizid][bType] = 4;
            }
        case 5:
            {
                businesstype = "Casino";
                BizzInfo[bizid][bType] = 5;
            }
        case 6:
            {
                businesstype = "Restaurant";
                BizzInfo[bizid][bType] = 6;
            }
        }
        if(BizzInfo[bizid][bOwned] ==0)
        {
            format(string, sizeof(string), "{0000FF}[%s For Sale]{F0CC00}\nPrice: $%d\nLevel: %d\nID: %d\nTo buy type /buybiz", businesstype,BizzInfo[bizid][bBuyPrice],BizzInfo[bizid][bLevelNeeded], bizid);
            UpdateDynamic3DTextLabelText(BizzInfo[bizid][bTextID], COLOR_DCHAT, string);
        }

        format(string, sizeof(string), "%s has edited BizID %d's Type to %d.", GetPlayerNameEx(playerid), bizid, amount);
        Log("logs/bedit.log", string);
    }
    SaveBizz();
    return 1;
}
Ok look I had your script few weeks ago NQRP , NVM just look : go to ScriptFiles and make the business or biz or bizz folder and make sure theres any biz.cfg - Then it will work.
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
its verry messy.
the first condition check break the code which then it will not reach the SaveBizz();

for the other stuff why dont you debug before coming here ?

use print("");
see what gets called what not
Can you give me the full code so I can check it?
Reply
#7

Bump, anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)