01.02.2014, 13:07
Hello,
Ok so, whenever i go to buy a bizz and do /buybizz i can buy it but it spams the chat with with "Error: You are not near any property" but i can still buy the bizz. I tried putting multiple coding in but meh nothing worked.
I hope someone can resolve this problem.
pawn Код:
CMD:buybizz(playerid, params[])
{
if(pInfo[playerid][OwnedBizz] == 1) return SendClientMessage(playerid,COLOR_PINK2,"Error: You already own a business");
for(new i; i < MAX_BUSINESSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, bInfo[i][Position][0], bInfo[i][Position][1], bInfo[i][Position][2]))
{
if(pInfo[playerid][pMoney] >= bInfo[i][Price])
{
if(strcmp(bInfo[i][bOwner], "Nobody", true) == 0)
{
new query[500],query2[500];
format(bInfo[i][bOwner], MAX_PLAYER_NAME, "%s", GetName(playerid));
pInfo[playerid][pMoney] -= bInfo[i][Price];
pInfo[playerid][pBizz] = bInfo[i][ID];
pInfo[playerid][OwnedBizz] = 1;
format(query,sizeof(query),"UPDATE businesses SET `owner` = '%s' WHERE `id` =%d",bInfo[i][bOwner],bInfo[i][ID]);
mysql_query(query);
format(query2,sizeof(query2),"UPDATE `accounts` SET `BusinessID` =%i,`OwnedBizz` = %i WHERE `id` =%d LIMIT 1", pInfo[playerid][pBizz],pInfo[playerid][OwnedBizz], pInfo[playerid][ID]);
mysql_query(query2);
print(query2);
print(query);
new string2[500];
format(string2, sizeof(string2), "%s\nOwner: %s\nPrice: %i\n ID: %i\nEntry Fee: %i",bInfo[i][bName],bInfo[i][bOwner], bInfo[i][Price],bInfo[i][ID],bInfo[i][bEntryFee]);
Update3DTextLabelText(bInfo[i][LabelID], 0xB0D5E8FF, string2);
SendClientMessage(playerid,0x9EC7DEFF,"Congratulations!, You have successfully bought the business");
}
else
{
SendClientMessage(playerid,COLOR_PINK2,"Error: This business is already owned");
}
}
else
{
SendClientMessage(playerid,COLOR_PINK2,"Error: You do not have enough cash");
}
}
else
{
SendClientMessage(playerid,COLOR_PINK2,"Error: You are not near any property");
}
}
return 1;
}
I hope someone can resolve this problem.