07.02.2015, 08:52
Hello, I made a command to buy business but when i come inside the pickup i tell me that i am not in any business
Please Help !
PHP код:
CMD:buybiz(playerid, params[])
{
new string[128];
for(new i = 0;i < sizeof(BusinessInfo);i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 5.0 ,BusinessInfo[i][bEntranceX], BusinessInfo[i][bEntranceY], BusinessInfo[i][bEntranceZ])) return SendClientMessage(playerid, COLOR_RED, "You arn't near any business");
if(BusinessInfo[i][bPrice] > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_RED, "You don't habe enoght money");
if(BusinessInfo[i][bOwned] != 0)
{
format(string,sizeof(string),"This business is already owned by: %s",BusinessInfo[i][bOwner]);
SendClientMessage(playerid, COLOR_RED, string);
}
BusinessInfo[i][bOwned] = 1;
BusinessInfo[i][bOwner] = PlayerName(playerid);
BusinessInfo[i][bLocked] = 0;
BusinessInfo[i][bMoney] = 0;
GivePlayerMoney(playerid, -BusinessInfo[i][bPrice]);
}
return 1;
}