Is there really nobody that can fix this? REP+
#1

Hello. if i sell my business to someone, and they do /accept business, it will only give the key, but the owner name of the business doesnt change (bOwner) i really have no idea how to fix this, i hope anyone of you can help me
REP+


/accept business command
pawn Код:
else if(strcmp(x_job,"business",true) == 0)
            {
                if(BizOffer[playerid] < 999)
                {
                    if(PlayerInfo[playerid][pCash] > BizPrice[playerid])
                    {
                        if(IsPlayerConnected(BizOffer[playerid]))
                        {
                            if(ProxDetectorS(3.0, playerid, BizOffer[playerid]))
                            {
                                for(new i = 0; i < sizeof(BizzInfo); i++)
                                {
                                        GetPlayerName(BizOffer[playerid], giveplayer, sizeof(giveplayer));
                                        if(!strcmp(BizzInfo[i][bOwner],giveplayer,true))
                                        {
                                            GetPlayerName(playerid, sendername, sizeof(sendername));
                                            strmid(BizzInfo[i][bOwner], sendername, 0, strlen(sendername), 255);
                                            format(string, sizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                                            format(string, sizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                            SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUE, string);
                                            format(string, sizeof(string), "%s has accepted the business from %s for $%d", sendername,giveplayer,BizPrice[playerid]);
                                            PayLog(string);
                                            DestroyPickup(BizzInfo[i][bPickupID]);
                                            printf("Bizz-ID: %i - New Owner: %s",i,sendername);
                                            BizzInfo[i][bOwner] = sendername;
                                            PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                            BizzInfo[i][bOwned] = 1;
                                            //strmid(BizzInfo[i][bOwner], playerid, 0, strlen(playerid), 255);
                                            OnPropTextdrawUpdate(i);
                                            OnBizzPickupUpdate(i);
                                            OnPropUpdate();
                                            UpdateAccount(playerid);
                                            PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                            PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                            GiveMoney(playerid, -BizPrice[playerid]);
                                            BizOffer[playerid] = 999;
                                            BizPrice[playerid] = 0;
                                            OnPropTextdrawUpdate(i);
                                            OnBizzPickupUpdate(i);
                                            OnPropUpdate();
                                            return 1;
                                        }
                                }
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "   You're too far away !");
                                return 1;
                            }
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You can't afford that !");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Nobody offered you a business.");
                    return 1;
                }
            }
Reply
#2

i will REP+ to the one that will help me
Reply
#3

Here
PHP код:
            else if(strcmp(x_job,"business",true) == 0)
            {
                if(
BizOffer[playerid] < 999)
                {
                    if(
PlayerInfo[playerid][pCash] > BizPrice[playerid])
                    {
                        if(
IsPlayerConnected(BizOffer[playerid]))
                        {
                            if(
ProxDetectorS(3.0playeridBizOffer[playerid]))
                            {
                                for(new 
0sizeof(BizzInfo); i++)
                                {
                                        
GetPlayerName(BizOffer[playerid], giveplayersizeof(giveplayer));
                                        if(!
strcmp(BizzInfo[i][bOwner],giveplayer,true))
                                        {
                                            
GetPlayerName(playeridsendernamesizeof(sendername));
                                            
strmid(BizzInfo[i][bOwner], sendername0strlen(sendername), 255);
                                            
format(stringsizeof(string), "* You accepted the Business for $%d from %s.",BizPrice[playerid],giveplayer);
                                            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                            
format(stringsizeof(string), "* %s accepted your Business, and the $%d was added to your Bank Account.",sendername,BizPrice[playerid]);
                                            
SendClientMessage(GuardOffer[playerid], COLOR_LIGHTBLUEstring);
                                            
format(stringsizeof(string), "%s has accepted the business from %s for $%d"sendername,giveplayer,BizPrice[playerid]);
                                            
PayLog(string);
                                            
DestroyPickup(BizzInfo[i][bPickupID]);
                                            
printf("Bizz-ID: %i - New Owner: %s",i,sendername);
                                            
//BizzInfo[i][bOwner] = sendername;
                                            
format(BizzInfo[i][bOwner], MAX_PLAYER_NAMEsendername);
                                            
PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                            
BizzInfo[i][bOwned] = 1;
                                            
//strmid(BizzInfo[i][bOwner], playerid, 0, strlen(playerid), 255);
                                            
OnPropTextdrawUpdate(i);
                                            
OnBizzPickupUpdate(i);
                                            
OnPropUpdate();
                                            
UpdateAccount(playerid);
                                            
PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
                                            
PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
                                            
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
                                            
GiveMoney(playerid, -BizPrice[playerid]);
                                            
BizOffer[playerid] = 999;
                                            
BizPrice[playerid] = 0;
                                            
OnPropTextdrawUpdate(i);
                                            
OnBizzPickupUpdate(i);
                                            
OnPropUpdate();
                                            return 
1;
                                        }
                                }
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GRAD1"   You're too far away !");
                                return 
1;
                            }
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   You can't afford that !");
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"   Nobody offered you a business.");
                    return 
1;
                }
            } 
The problem were you tried to set the owner to a int when sendername is a string, in order to change a string, either use format or strcat if you're clearing the string first. Strcat are faster, but you need to set the string to null before.
Reply
#4

Thank you, REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)