27.06.2011, 14:35
This is cali house script , but it saves houses on player's n
ame and only loads the house on player login but i want it on gamemodeint
All houses are saved in .ini what i need is a loop so that all houses are created by reading all .ini on gamemodeint is it possible?and tell how
Код:
public OnPlayerConnect(playerid) { for(new h = 0; h < sizeof(HouseInfo); h++) { new pname[MAX_PLAYER_NAME]; new name[256], desc[256]; new file[100], str[128]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), "Houses/%s.ini", pname); if(dini_Exists(file)) { name = dini_Get(file, "Name"); desc = dini_Get(file, "Description"); HouseInfo[h][Owner] = pname; HouseInfo[h][Price] = dini_Int(file, "Price"); HouseInfo[h][PX] = dini_Float(file, "Pickup X"); HouseInfo[h][PY] = dini_Float(file, "Pickup Y"); HouseInfo[h][PZ] = dini_Float(file, "Pickup Z"); HouseInfo[h][TX] = dini_Float(file, "Teleport X"); HouseInfo[h][TY] = dini_Float(file, "Teleport Y"); HouseInfo[h][TZ] = dini_Float(file, "Teleport Z"); HouseInfo[h][TA] = dini_Float(file, "Teleport Angle"); HouseInfo[h][Int] = dini_Int(file, "Interior"); HouseInfo[h][Vir] = dini_Int(file, "Virtual"); HouseInfo[h][Cash] = dini_Int(file, "Cash"); HouseInfo[h][Rentable] = dini_Int(file, "Rentable"); HouseInfo[h][RentPrice] = dini_Int(file, "Rent Price"); HouseInfo[h][CarModel] = dini_Int(file, "Car Model"); HouseInfo[h][CarX] = dini_Float(file, "Car X"); HouseInfo[h][CarY] = dini_Float(file, "Car Y"); HouseInfo[h][CarZ] = dini_Float(file, "Car Z"); HouseInfo[h][CarRot] = dini_Float(file, "Car Rotation"); if(HouseInfo[h][Rentable] == 0) { format(str, sizeof(str), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname); } else { format(str, sizeof(str), "Name: %s\n\nDescription: %s\n\nOwner: %s\n\nRent Price: $%i", name, desc, pname, HouseInfo[h][RentPrice]); } HouseLabel[playerid] = Create3DTextLabel(str, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0); HouseOwner[playerid] = true; HousePickup[playerid] = CreatePickup(1273, 23, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]); HouseCar[playerid] = CreateVehicle(HouseInfo[h][CarModel], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], HouseInfo[h][CarRot], -1, -1, 5000000); HouseUser[playerid] = playerid; for(new i; i<MAX_PLAYERS; i++) { SetPlayerMapIcon(i, HouseUser[playerid], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], 31, MAPICON_GLOBAL); } return 1; } } return 1; }
All houses are saved in .ini what i need is a loop so that all houses are created by reading all .ini on gamemodeint is it possible?and tell how