[HELP]Business
#1

Hello again. I have a business system and it works just fine, but when I /sellbusiness the server says on main chat for example : Dragonu has sold Santos Bank. The thing is that I named the "Santos Bank" "Los Santos Bank" so in game when i sell my business it only appears Dragonu sold Santos Bank, instead of Dragonu sold Los Santos Bank.

Here is the business code :
pawn Код:
1480.982177,-1770.193603,18.795799,389.832000,173.746200,1008.382812,Los Santos Bank,For Sale,0,0,100000000,35,0,3,1,49400,98
And here is the business sale script
pawn Код:
if(strcmp(cmd, "/sellbusiness", true) == 0 || strcmp(cmd, "/sellbiz", true) == 0)
    {
        if(PlayerInfo[playerid][pBusinessKey] == INVALID_BUSINESS_ID)
        {
            SendClientMessage(playerid, COLOR_RED, "You cannot sell your business because you don't have one.");
            return 1;
        }
        else
        {
            new businessid = PlayerInfo[playerid][pBusinessKey];
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            SendClientMessage(playerid, COLOR_YELLOW, "You have successfully sold your business.");

            PlayerInfo[playerid][pBusinessKey] = INVALID_BUSINESS_ID;

            new bizzname[32];
            strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
            format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], bizzname);
            SendClientMessageToAll(COLOR_YELLOW, string);

            GivePlayerMoney(playerid, BusinessInfo[businessid][bPrice]/2);
            SellBusiness(businessid);
            OnBusinessUpdate();
        }
        return 1;
    }
Reply
#2

The size of 'bizzname' is to small
Increase it to 50 or so
Reply
#3

Where did you see that size?
Reply
#4

pawn Код:
new bizzname[50];
            strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
            format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], bizzname);
            SendClientMessageToAll(COLOR_YELLOW, string);
Just replace the lines with the lines above

If that doesn't work, try changing the size of string
Reply
#5

Ok i increased that to "50" but still the same thing, any more help please?
Reply
#6

pawn Код:
if(strcmp(cmd, "/sellbusiness", true) == 0 || strcmp(cmd, "/sellbiz", true) == 0)
    {
        if(PlayerInfo[playerid][pBusinessKey] == INVALID_BUSINESS_ID)
        {
            SendClientMessage(playerid, COLOR_RED, "You cannot sell your business because you don't have one.");
            return 1;
        }
        else
        {
            new businessid = PlayerInfo[playerid][pBusinessKey];
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            SendClientMessage(playerid, COLOR_YELLOW, "You have successfully sold your business.");

            PlayerInfo[playerid][pBusinessKey] = INVALID_BUSINESS_ID;

            new bizzname[32];
            strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
            format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], BusinessInfo[businessid][bDescription]);
            SendClientMessageToAll(COLOR_YELLOW, string);

            GivePlayerMoney(playerid, BusinessInfo[businessid][bPrice]/2);
            SellBusiness(businessid);
            OnBusinessUpdate();
        }
        return 1;
    }
Reply
#7

Thank you very much, but I have exactly this problem on /buybusiness, here is the code :

pawn Код:
if(strcmp(cmd, "/buybusiness", true) == 0 || strcmp(cmd, "/buybiz", true) == 0)
    {
        for(new i = 0; i <MAX_HOUSES; i++)
        {
            if (PlayerToPoint(3.0, playerid, BusinessInfo[i][bEntrancex], BusinessInfo[i][bEntrancey], BusinessInfo[i][bEntrancez]))
            {
                if(PlayerInfo[playerid][pLevel] < BusinessInfo[i][bLevel])
                {
                    format(string, sizeof(string), "You must be level %d to buy this business.", BusinessInfo[i][bLevel]);
                    SendClientMessage(playerid, COLOR_RED, string);
                    return 1;
                }
                if(PlayerInfo[playerid][pBusinessKey] != INVALID_BUSINESS_ID)
                {
                    SendClientMessage(playerid, COLOR_RED, "You are already owning a business, sell that first.");
                    return 1;
                }
                if(BusinessInfo[i][bOwned] == 1)
                {
                    SendClientMessage(playerid, COLOR_RED, "This business you are trying to buy is already owned.");
                    return 1;
                }
                if(GetPlayerMoney(playerid) < BusinessInfo[i][bPrice])
                {
                    format(string, sizeof(string), "You need %d$ dollars in cash to buy this business.", BusinessInfo[i][bPrice]);
                    SendClientMessage(playerid, COLOR_RED, string);
                    return 1;
                }
                else
                {
                    SetPlayerPos(playerid, BusinessInfo[i][bExitx], BusinessInfo[i][bExity], BusinessInfo[i][bExitz]);
                    SetPlayerInterior(playerid, BusinessInfo[i][bInt]);
                    SetPlayerVirtualWorld(playerid, BusinessInfo[i][bWorld]);
                    GivePlayerMoney(playerid, -BusinessInfo[i][bPrice]);
                    BusinessInfo[i][bOwned] = 1;
                    strmid(BusinessInfo[i][bOwner], PlayerName[playerid], false, strlen(PlayerName[playerid]), 25);
                    PlayerInfo[playerid][pBusinessKey] = i;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    format(string, sizeof(string), "You have successfully bought this business for %d$.", BusinessInfo[i][bPrice]);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    new bizzname[32];
                    strmid(bizzname, BusinessInfo[i][bDescription], 3, strlen(BusinessInfo[i][bDescription]), 32);
                    format(string, sizeof(string), "%s has bought business %s.", PlayerName[playerid], bizzname);
                    SendClientMessageToAll(COLOR_YELLOW, string);
                    OnBusinessUpdate();
                    return 1;
                }
            }
        }
        return 1;
    }
Here is the line that sends the message to the whole server
pawn Код:
strmid(bizzname, BusinessInfo[i][bDescription], 3, strlen(BusinessInfo[i][bDescription]), 32);
                    format(string, sizeof(string), "%s has bought business %s.", PlayerName[playerid], bizzname);
Reply
#8

PHP код:
if(strcmp(cmd"/buybusiness"true) == || strcmp(cmd"/buybiz"true) == 0)
    {
        for(new 
0<MAX_HOUSESi++)
        {
            if (
PlayerToPoint(3.0playeridBusinessInfo[i][bEntrancex], BusinessInfo[i][bEntrancey], BusinessInfo[i][bEntrancez]))
            {
                if(
PlayerInfo[playerid][pLevel] < BusinessInfo[i][bLevel])
                {
                    
format(stringsizeof(string), "You must be level %d to buy this business."BusinessInfo[i][bLevel]);
                    
SendClientMessage(playeridCOLOR_REDstring);
                    return 
1;
                }
                if(
PlayerInfo[playerid][pBusinessKey] != INVALID_BUSINESS_ID)
                {
                    
SendClientMessage(playeridCOLOR_RED"You are already owning a business, sell that first.");
                    return 
1;
                }
                if(
BusinessInfo[i][bOwned] == 1)
                {
                    
SendClientMessage(playeridCOLOR_RED"This business you are trying to buy is already owned.");
                    return 
1;
                }
                if(
GetPlayerMoney(playerid) < BusinessInfo[i][bPrice])
                {
                    
format(stringsizeof(string), "You need %d$ dollars in cash to buy this business."BusinessInfo[i][bPrice]);
                    
SendClientMessage(playeridCOLOR_REDstring);
                    return 
1;
                }
                else
                {
                    
SetPlayerPos(playeridBusinessInfo[i][bExitx], BusinessInfo[i][bExity], BusinessInfo[i][bExitz]);
                    
SetPlayerInterior(playeridBusinessInfo[i][bInt]);
                    
SetPlayerVirtualWorld(playeridBusinessInfo[i][bWorld]);
                    
GivePlayerMoney(playerid, -BusinessInfo[i][bPrice]);
                    
BusinessInfo[i][bOwned] = 1;
                    
strmid(BusinessInfo[i][bOwner], PlayerName[playerid], falsestrlen(PlayerName[playerid]), 25);
                    
PlayerInfo[playerid][pBusinessKey] = i;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
format(stringsizeof(string), "You have successfully bought this business for %d$."BusinessInfo[i][bPrice]);
                    
SendClientMessage(playeridCOLOR_YELLOWstring);
                    new 
bizzname[32];
                    
strmid(bizznameBusinessInfo[i][bDescription], 3strlen(BusinessInfo[i][bDescription]), 32);
                    
format(stringsizeof(string), "%s has bought business %s."PlayerName[playerid], BusinessInfo[i][bDescription]);
                    
SendClientMessageToAll(COLOR_YELLOWstring);
                    
OnBusinessUpdate();
                    return 
1;
                }
            }
        }
        return 
1;
    } 
Reply
#9

Thanks, it works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)