10.12.2018, 13:59
Quote:
Because HouseInfo goes out of bounds. Replace with MAX_HOUSES+1 with sizeof (HouseInfo) in the loop.
When a player is in range of a house, set their interior and position and stop the loop using break; |
But now i have problem with this command.
Код:
CMD:buyhouse(playerid,params[]) { for(new h=0;h<sizeof(HouseInfo);h++) { if(IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[h][hEnterX],HouseInfo[h][hEnterY],HouseInfo[h][hEnterZ])) { if(GetPlayerMoney(playerid) >= HouseInfo[h][hPrice]) { new hpath[256]; format(hpath,sizeof(hpath),"/Houses/%d.ini",h); dini_IntSet(hpath,"hOwned",1); dini_Set(hpath,"hOwner",GetName(playerid)); PlayerHouse[playerid] = h; Delete3DTextLabel(HouseInfo[h][Label]); LoadHouses(); break; } } } return 1; }