03.09.2011, 17:58
Can you help me doing that?
I had created a file (housecount.ini), and I want that when I create a new house, the server adds 1 to the housecount, so, if are just 20 houses created, the server will only check the files with ID between 1 and 20.
I'll leave here the code where it checks the files ..
I had created a file (housecount.ini), and I want that when I create a new house, the server adds 1 to the housecount, so, if are just 20 houses created, the server will only check the files with ID between 1 and 20.
I'll leave here the code where it checks the files ..
Код:
public OnFilterScriptInit() { print("\n--------------------------------------"); print("Stefan's House System"); print("--------------------------------------\n"); for(new i = 0; i <= MAX_PLAYERS; i++) { SetTimerEx("ReadPlayerHouseData", 1000, true, "d", i); } for(new h = 0; h <= MAX_HOUSES; h++) // Player Homes { LoadPlayerHouse(h); } SetTimer("SaveAllPlayerData",60000,true); return true; }
Код:
public ReadPlayerHouseData(playerid) { new string[256], house[64]; for(new h = 0; h <= MAX_HOUSES; h++) { format(house, sizeof(house), "/Houses/%d.dini.save", h); if(dini_Exists(house)) { if(HouseInfo[h][hSellable] == 1) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ])) { format(string, sizeof(string), "~g~] House for Sale ]~n~~w~Level:~y~ %d~n~~w~Sell Price:~r~ %d", HouseInfo[h][hLevel], HouseInfo[h][hSell]); GameTextForPlayer(playerid,string, 3000, 3); } } else if(HouseInfo[h][hSellable] == 0 && HouseInfo[h][hRentable] == 0) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ])) { format(string, sizeof(string), "~w~Owner:~y~ %s~n~~w~Level:~r~ %d", HouseInfo[h][hName], HouseInfo[h][hLevel]); GameTextForPlayer(playerid,string, 3000, 3); } } else if(HouseInfo[h][hSellable] == 0 && HouseInfo[h][hRentable] == 1) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ])) { format(string, sizeof(string), "~w~Owner:~y~ %s~n~~w~Level:~r~ %d~n~~w~Rent Cost:~r~ %d", HouseInfo[h][hName], HouseInfo[h][hLevel], HouseInfo[h][hRent]); GameTextForPlayer(playerid,string, 3000, 3); } } } } }