26.06.2016, 11:39
PHP код:
forward OnPropTextdrawUpdate(bizzid);
public OnPropTextdrawUpdate(bizzid)
{
if(BizzInfo[bizzid][bOwned] == 0)
{
Delete3DTextLabel(BizzLabel[bizzid]);
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Status: For Sale \nPrice: $%s",BizzInfo[bizzid][bMessage],Comma(BizzInfo[bizzid][bBuyPrice]));
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],25, 0, 1);
}
if(BizzInfo[bizzid][bOwned] == 1)
{
printf("Bizz-ID #2: %i - Owner: %s",bizzid,BizzInfo[bizzid][bOwner]);
Delete3DTextLabel(BizzLabel[bizzid]);
format(PropertyString,sizeof(PropertyString),""COL_BIZ"%s \n"COL_WHITE"Owner: %s \nEntry Fee: $%s",BizzInfo[bizzid][bMessage],BizzInfo[bizzid][bOwner],Comma(BizzInfo[bizzid][bEntranceCost]));
BizzLabel[bizzid] = Create3DTextLabel(PropertyString ,COLOR_BIZ,BizzInfo[bizzid][bEntranceX], BizzInfo[bizzid][bEntranceY], BizzInfo[bizzid][bEntranceZ],25, 0, 1);
}
return 1;
}
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));
if(!strcmp(BizzInfo[i][bOwner],giveplayer,true))
{
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);
printf("Bizz-ID: %i - New Owner: %s",i,sendername);
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;
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;
}
}