I can't fix this :(
#1

Hi, i have made a /sellbiz [playerid] [price] , and /accept business command, but when i Sells my business to someone, it removes the key from the seller correctly, but, it doesnt give the key to the buyer.
I hope anyone can help me Rep+


/sellbiz command
pawn Код:
if(strcmp(cmd, "/sellbiz", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pPbiskey] == 255)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You do not own a business.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{F7FF61}Usage:"COL_WHITE" /sellbiz [playerid/PartOfName] [price]");
                return 1;
            }
            new money;
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "{F7FF61}Usage:"COL_WHITE" /sellbiz [playerid/PartOfName] [price]");
                return 1;
            }
            money = strval(tmp);
            if(money < 2000 || money > 10000000) { SendClientMessage(playerid, COLOR_GREY, "   Price can't be lower than $2000, or above $10,000,000 !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(ProxDetectorS(8.0, playerid, giveplayerid))
                    {
                        //if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "   You can't offer yourself your own business !"); return 1; }
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You offered your business to %s for $%d.", giveplayer, money);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* %s wants to sell you their business for $%d, (type /accept business) to accept.", sendername, money);
                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                        BizOffer[giveplayerid] = playerid;
                        BizPrice[giveplayerid] = money;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   That player is not near you !");
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
            }
        }
        return 1;
    }

/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(GuardOffer[playerid], giveplayer, sizeof(giveplayer));
                                    GetPlayerName(playerid, sendername, sizeof(sendername));
                                    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);
                                    PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
                                    strmid(BizzInfo[i][bOwner], sendername, 0, strlen(sendername), 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];
                                    GivePlayerMoney(playerid, -BizPrice[playerid]);
                                    BizOffer[playerid] = 999;
                                    BizPrice[playerid] = 0;
                                    return 1;
                                }
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "   You're too far away !");
                                return 1;
                            }
                        }
                        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

Replace accept business command with this.
Код:
			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(GuardOffer[playerid], giveplayer, sizeof(giveplayer));
									GetPlayerName(playerid, sendername, sizeof(sendername));
									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);
									PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
									strmid(BizzInfo[i][bOwner], sendername, 0, strlen(sendername), 255);
									OnPropTextdrawUpdate(i);
									OnBizzPickupUpdate(i);
									OnPropUpdate();
									UpdateAccount(playerid);
									PlayerInfo[playerid][pPbiskey] = PlayerInfo[BizOffer[playerid]][pPbiskey];
									PlayerInfo[BizOffer[playerid]][pPbiskey] = 255;
									PlayerInfo[BizOffer[playerid]][pAccount] += BizPrice[playerid];
									PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-BizPrice[playerid];
									GivePlayerMoney(playerid, -BizPrice[playerid]);
					        		BizOffer[playerid] = 999;
									BizPrice[playerid] = 0;
									return 1;
		                        }
							}
							else
							{
							    SendClientMessage(playerid, COLOR_GRAD1, "   You're too far away !");
							    return 1;
							}
						}
						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


Forum Jump:


Users browsing this thread: 1 Guest(s)