Command Bugged.
#7

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

    new string[128], choice[32], houseid, amount;
    if(sscanf(params, "s[32]dD", choice, houseid, amount))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bedit [name] [business id] [(Optional)amount]");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, Type (1-3) (Leisure, Consumer, Retail), Level, Price, Delete");
        return 1;
    }

    if(strcmp(choice, "delete", true) == 0)
    {
        ClearBusiness(houseid);
        format(string, sizeof(string), "%s has removed Business ID %d", GetPlayerNameEx(playerid), houseid);
        Log("logs/bedit.log", string);
        SaveBusinesses();
    }
    else if(strcmp(choice, "interior", true) == 0)
    {
        GetPlayerPos(playerid, BizInfo[houseid][bInteriorX], BizInfo[houseid][bInteriorY], BizInfo[houseid][bInteriorZ]);
        GetPlayerFacingAngle(playerid, BizInfo[houseid][bInteriorA]);
        BizInfo[houseid][bHInteriorWorld] = GetPlayerInterior( playerid );
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
        SaveBusinesses();

        format(string, sizeof(string), "%s has edited Business ID %d's Interior.", GetPlayerNameEx(playerid), houseid);
        Log("logs/bedit.log", string);
        return 1;
    }
    else if(strcmp(choice, "custominterior", true) == 0)
    {
        if(BizInfo[houseid][bCustomInterior] == 0)
        {
            BizInfo[houseid][bCustomInterior] = 1;
            SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom interior!" );
        }
        else
        {
            BizInfo[houseid][bCustomInterior] = 0;
            SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) interior!" );
        }
        SaveBusinesses();

        format(string, sizeof(string), "%s has edited Business ID %d's Custom Interior.", GetPlayerNameEx(playerid), houseid);
        Log("logs/bedit.log", string);
        return 1;
    }
    else if(strcmp(choice, "customexterior", true) == 0)
    {
        if(BizInfo[houseid][bCustomExterior] == 0)
        {
            BizInfo[houseid][bCustomExterior] = 1;
            SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom exterior!" );
        }
        else
        {
            BizInfo[houseid][bCustomExterior] = 0;
            SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) exterior!" );
        }
        SaveBusinesses();

        format(string, sizeof(string), "%s has edited Business ID %d's Custom Exterior.", GetPlayerNameEx(playerid), houseid);
        Log("logs/bedit.log", string);
        return 1;
    }
    else if(strcmp(choice, "exterior", true) == 0)
    {
        GetPlayerPos(playerid, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
        GetPlayerFacingAngle(playerid, BizInfo[houseid][bExteriorA]);
        SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
        //DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
        SaveBusinesses();

        format(string, sizeof(string), "%s has edited Business ID %d's Exterior.", GetPlayerNameEx(playerid), houseid);
        Log("logs/bedit.log", string);
        if(BizInfo[houseid][bOwned] ==0)
        {
            DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
            DestroyDynamic3DTextLabel(BizInfo[houseid][bTextID]);
            format(string, sizeof(string), "This business is\n for sale!\nDescription: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            BizInfo[houseid][bTextID] = CreateDynamic3DTextLabel( string, COLOR_LIGHTBLUE, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
            BizInfo[houseid][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
        }
        else
        {
            DestroyDynamicPickup(BizInfo[houseid][bPickupID]);
            DestroyDynamic3DTextLabel(BizInfo[houseid][bTextID]);
            format(string, sizeof(string), "This business is owned by\n%s\nDescription: %s\nLevel: %d\nType: %d\nID: %d",BizInfo[houseid][bOwner],BizInfo[houseid][bDescription],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            BizInfo[houseid][bTextID] = CreateDynamic3DTextLabel(string,COLOR_LIGHTBLUE,BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
            BizInfo[houseid][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[houseid][bExteriorX], BizInfo[houseid][bExteriorY], BizInfo[houseid][bExteriorZ]);
        }
        SaveBusinesses();
    }
    else if(strcmp(choice, "level", true) == 0)
    {
        BizInfo[houseid][bLevel] = amount;
        format(string, sizeof(string), "You have set the business level to %d.", amount);
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizInfo[houseid][bOwned] ==0)
        {
            format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
        }
        else
        {
            format(string, sizeof(string), "This business is owned by\n%s\nDescription: %s\nLevel: %d\nType: %d\nID: %d",BizInfo[houseid][bOwner],BizInfo[houseid][bDescription],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
        }
        format(string, sizeof(string), "%s has edited Business ID %d's Level to %d.", GetPlayerNameEx(playerid), houseid, amount);
        Log("logs/bedit.log", string);
        SaveBusinesses();
    }
    else if(strcmp(choice, "price", true) == 0)
    {
        BizInfo[houseid][bValue] = amount;
        format(string, sizeof(string), "You have set the businesses price to $%d.", amount );
        SendClientMessageEx(playerid, COLOR_WHITE, string);
        if(BizInfo[houseid][bOwned] ==0)
        {
            format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
        }

        format(string, sizeof(string), "%s has edited Business ID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
        Log("logs/bedit.log", string);
        SaveBusinesses();
    }
    else if(strcmp(choice, "type", true) == 0)
    {
        switch(amount)
        {
        case 1:
            {
                BizInfo[houseid][bType] = 1;
                SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 1 (Leisure)" );
            }
        case 2:
            {
                BizInfo[houseid][bType] = 2;
                SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 2 (Consumer)" );
            }
        case 3:
            {
                BizInfo[houseid][bType] = 3;
                SendClientMessageEx(playerid, COLOR_WHITE, "You have set the businesses type to 3 (Retail)" );
            }
        }
        if(BizInfo[houseid][bOwned] ==0)
        {
            format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
            UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
        }

        format(string, sizeof(string), "%s has edited Business ID %d's Type to %d.", GetPlayerNameEx(playerid), houseid, amount);
        Log("logs/bedit.log", string);
        SaveBusinesses();
    }
    SaveBusinesses();
    return 1;
}

CMD:bname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 99998 || PlayerInfo[playerid][pShopTech] < 1)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
        return 1;
    }

    new string[128], houseid, desc[24];
    if(sscanf(params, "ds[128]", houseid, desc)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /bname [business id] [name]");

    format(BizInfo[houseid][bDescription], 128, "%s", desc);
    format(string, sizeof(string), "You have set the business description to %s", desc);
    SendClientMessageEx(playerid, COLOR_WHITE, string);

    if(BizInfo[houseid][bOwned] == 0)
    {
        format(string, sizeof(string), "This business is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nType: %d\nID: %d\nTo buy this business type /buybusiness",BizInfo[houseid][bDescription],BizInfo[houseid][bValue],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
        UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
    }
    else
    {
        format(string, sizeof(string), "This business is owned by\n %s\nDescription: %s\nLevel: %d\nType: %d\nID: %d",BizInfo[houseid][bOwner],BizInfo[houseid][bDescription],BizInfo[houseid][bLevel],BizInfo[houseid][bType],houseid);
        UpdateDynamic3DTextLabelText(BizInfo[houseid][bTextID], COLOR_LIGHTBLUE, string);
    }

    format(string, sizeof(string), "%s has edited Business ID %d's description to %s.", GetPlayerNameEx(playerid), houseid, desc);
    Log("logs/bedit.log", string);

    return 1;
}
Reply


Messages In This Thread
Command Bugged. - by Drago987 - 04.03.2014, 18:39
Re: Command Bugged. - by AaronFarley - 04.03.2014, 18:43
Re: Command Bugged. - by Drago987 - 04.03.2014, 19:25
Re: Command Bugged. - by Konstantinos - 04.03.2014, 20:01
Re: Command Bugged. - by Drago987 - 04.03.2014, 20:32
Re: Command Bugged. - by Drago987 - 05.03.2014, 00:16
Re: Command Bugged. - by AchievementMaster360 - 05.03.2014, 00:30
Re: Command Bugged. - by FutureGenerationGaming - 05.03.2014, 01:55
Re: Command Bugged. - by Drago987 - 05.03.2014, 14:52
Re: Command Bugged. - by FutureGenerationGaming - 06.03.2014, 01:14

Forum Jump:


Users browsing this thread: 1 Guest(s)