08.07.2012, 23:16
So , here's the code to sell biz to market / the state aka system /
I need to make it in the following form:
Player 1 [ with the biz ] sell the biz to player 2 [ who will buy it ] .
Player 1 sell the biz to player 2.
Player 2 can /accept or /deny.
If he /accept he became biz owner of that buisness .
If he /deny he cancel the deal.
I tried it several time but its not working ;/
Код:
CMD:sellbiztomarket(playerid, params[]) { new string[128]; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!PlayerInfo[playerid][pBiz] && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a business."); if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiztomarket [confirm]"); if(!strcmp(params, "confirm", true)) { new done; if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[PlayerInfo[playerid][pBiz]][bX], BizInfo[PlayerInfo[playerid][pBiz]][bY], BizInfo[PlayerInfo[playerid][pBiz]][bZ])) { GiveZaiatMoney(playerid, (75*BizInfo[PlayerInfo[playerid][pBiz]][bPrice])/100); BizInfo[PlayerInfo[playerid][pBiz]][bStatus] = 0; format(BizInfo[PlayerInfo[playerid][pBiz]][bOwner], 32, "The State"); format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: For Sale\nPrice: $%d", PlayerInfo[playerid][pBiz], RBT(PlayerInfo[playerid][pBiz]), BizInfo[PlayerInfo[playerid][pBiz]][bOwner], BizInfo[PlayerInfo[playerid][pBiz]][bPrice]); UpdateDynamic3DTextLabelText(BizInfo[PlayerInfo[playerid][pBiz]][bText], COLOR_WHITE, string); SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)"); format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), PlayerInfo[playerid][pBiz]); Log("logs/business.log", string); PlayerInfo[playerid][pBiz] = 0; done = 1; } if(!done) { new idx = PlayerInfo[playerid][pVBiz]; if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])) { GiveZaiatMoney(playerid, (75*BizInfo[idx][bPrice])/100); BizInfo[idx][bStatus] = 0; format(BizInfo[idx][bOwner], 32, "The State"); format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: For Sale\nPrice: $%d", idx, RBT(idx), BizInfo[idx][bOwner], BizInfo[idx][bPrice]); UpdateDynamic3DTextLabelText(BizInfo[idx][bText], COLOR_WHITE, string); SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your business to The State. (75 percent of original price was paid back)"); format(string, sizeof(string), "%s has sold business id %d to the market.", RPN(playerid), idx); Log("logs/business.log", string); PlayerInfo[playerid][pVBiz] = 0; done = 1; } } if(!done) { SendClientMessage(playerid, COLOR_GREY, "You are not near your business."); return 1; } }
Player 1 [ with the biz ] sell the biz to player 2 [ who will buy it ] .
Player 1 sell the biz to player 2.
Player 2 can /accept or /deny.
If he /accept he became biz owner of that buisness .
If he /deny he cancel the deal.
I tried it several time but its not working ;/