CMD:furniture(playerid, params[]) { new string[128]; for(new h = 0; h < MAX_OWNABLE_HOUSES+1;h++) { format(string, sizeof(string), "HouseKey_%d", h+1); if(GetPVarInt(playerid,"HouseKey_1") == 1000) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You do not own a house!"); if(IsPlayerInRangeOfPoint(playerid, 50.0,HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][0],HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][1],HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][2]) && GetPlayerVirtualWorld(playerid) == HouseInfo[GetPVarInt(playerid,string)][Vw]) { HouseKeyForFurniture[playerid] = h; SendClientMessage(playerid, COLOR_ORANGE, "Note: Go to your house interior and type /showhouseinfo to show the Object ID's and their position to remove from"); SendClientMessage(playerid, COLOR_ORANGE, "Note: You must be in a range of 3.0 meters of the object *May Course lag if its more*"); ShowPlayerDialog(playerid, HouseFurniture, DIALOG_STYLE_LIST, "Furniture Menu", "Add Furniture\nRemove Furniture by ID\nRemove Closest Furniture\nRemove All Furniture", "Continue", "Cancel"); return 1; } else return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not near any of your houses!"); } return 1; }
CMD:showhouseinfo(playerid, params[]) { new string[128]; if(GetPVarInt(playerid,"HouseInfoDisplay") == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are already showing a houses information!"); for(new h = 0; h < MAX_OWNABLE_HOUSES+1;h++) { format(string, sizeof(string), "HouseKey_%d", h+1); if(GetPVarInt(playerid,"HouseKey_1") == 1000) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You do not own a house!"); if(IsPlayerInRangeOfPoint(playerid, 50.0,HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][0],HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][1],HouseInfo[GetPVarInt(playerid,string)][HouseIntPos][2]) && GetPlayerVirtualWorld(playerid) == HouseInfo[h][Vw]) { for(new f = 0; f < MAX_FURNITURE;f++) { format(string, sizeof(string), "ObjectID%i", f); if(HouseInfo[GetPVarInt(playerid,string)][ObjectID][h] > 0) { new string1[256]; format(string1, sizeof(string1), "Object ID: %d", f); Object3D[f] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, HouseInfo[GetPVarInt(playerid,string)][ObjectPosX][f], HouseInfo[GetPVarInt(playerid,string)][ObjectPosY][f], HouseInfo[GetPVarInt(playerid,string)][ObjectPosZ][f]+0.75, 3.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, HouseInfo[GetPVarInt(playerid,string)][ObjectVW][f], HouseInfo[GetPVarInt(playerid,string)][ObjectInt][f], playerid, 100.0); return 1; } } } else return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not near any of your houses!"); } return 1; }
case 2: { for(new h = 0; h < MAX_FURNITURE;h++) { new i = HouseKeyForFurniture[playerid]; if(IsPlayerInRangeOfPoint(playerid, 5.0,HouseInfo[i][ObjectPosX][h], HouseInfo[i][ObjectPosY][h], HouseInfo[i][ObjectPosZ][h]) && GetPlayerVirtualWorld(playerid) == HouseInfo[h][Vw]) { new ModelFile[124]; new key = HouseKeyForFurniture[playerid]; new String[124]; format(ModelFile,sizeof(ModelFile),"Houses/furnhouse%i.ini",key); format(String,sizeof(String),"ObjectID%i",listitem); HouseInfo[key][ObjectID][h] = 0; DOF2_SetInt(ModelFile,String,0); DestroyDynamicObject(HouseObject[key][h]); format(String,sizeof(String),"Furniture Object ID [%d] deleted.", h); SendClientMessage(playerid, 0x42F3F198, String); return 1; } } }
I don't know how many times I've said this already in how many different threads: never return inside a loop unless you purposely want to end it! You cannot possibly know if the player isn't in range of any house before you have checked them all.
|