Problem with Purchasable Clothing & PetCare teleport [RP]

mynouu

New Member
Dec 17, 2020
2
1
Hi !
Sorry for my English, i'm french. Hope u will understand me x)
I Have 2 problem :oops:
1st : Currently i'm trying to add a system of Petcare for animals (RP). When the users take part in an illegal action or die or shot another user, their pet goes to the PetCare.
I have the code for all animals added in my retro when the user disconnect the pet is teleported to ID 80 it work perfectly. but i want a Nursery for a unique animal (baby = A0 pet35 or pet35 in interaction) teleport to ID 81. It's easy for all animal, but a little difficult for me to isolate unique animal x)
I hope it's possible ..
Here is the code for all animals ..
public void Dispose(int ClientId)
{
if (this.GetHabbo() != null && this.GetHabbo().InRoom)
{
if (this.GetHabbo().Travaille)
this.GetHabbo().stopWork();
if (this.GetHabbo().animalId != 0 && this.GetHabbo().animal != null)
{
GameClient client = this.GetHabbo().GetClient();
Room room1 = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(this.GetHabbo().animal.RoomId);
if (room1 == null)
return;
int petId = this.GetHabbo().animal.PetId;
if (!room1.GetRoomUserManager().TryGetPet(petId, out RoomUser _))
{
if (!room1.CheckRights(client) && room1.WhoCanKick != 2 && room1.Group == null || room1.Group != null && !room1.CheckRights(client, false, true))
return;
RoomUser roomUserByHabbo = client.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(petId);
if (roomUserByHabbo == null || roomUserByHabbo.GetClient() == null || roomUserByHabbo.GetClient().GetHabbo() == null)
return;
roomUserByHabbo.GetClient().GetHabbo().PetId = 0;
room1.SendMessage((IServerPacket)new UserRemoveComposer(roomUserByHabbo.VirtualId), false);
room1.SendMessage((IServerPacket)new UsersComposer(roomUserByHabbo), false);
return;
}
if (client.GetHabbo().Id != this.GetHabbo().animal.OwnerId && !room1.CheckRights(client, true, false))
{
client.SendWhisper("You can only pickup your own pets, to kick a pet you must have Room rights.", 0);
return;
}
this.GetHabbo().animal.RoomId = 0;
this.GetHabbo().animal.PlacedInRoom = false;
Pet Pet1 = this.GetHabbo().animal;
if (Pet1 != null)
{
using (IQueryAdapter queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
queryReactor.RunQuery("UPDATE bots SET room_id = '0', x = '0', Y = '0', Z = '0' WHERE id = '" + (object)Pet1.PetId + "' LIMIT 1");
queryReactor.RunQuery("UPDATE bots_petdata SET experience = '" + (object)Pet1.experience + "', energy = '" + (object)Pet1.Energy + "', nutrition = '" + (object)Pet1.Nutrition + "', respect = '" + (object)Pet1.Respect + "' WHERE id = '" + (object)Pet1.PetId + "' LIMIT 1");
}
}
if (Pet1.OwnerId != client.GetHabbo().Id)
{
GameClient clientByUserId = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Pet1.OwnerId);
if (clientByUserId != null && clientByUserId.GetHabbo().GetInventoryComponent().TryAddPet(this.GetHabbo().animal))
clientByUserId.SendMessage((IServerPacket)new PetInventoryComposer(clientByUserId.GetHabbo().GetInventoryComponent().GetPets()));
room1.GetRoomUserManager().RemoveBot(this.GetHabbo().animal.VirtualId, false);
return;
}
if (client.GetHabbo().GetInventoryComponent().TryAddPet(this.GetHabbo().animal))
{
room1.GetRoomUserManager().RemoveBot(this.GetHabbo().animal.VirtualId, false);
client.SendMessage((IServerPacket)new PetInventoryComposer(client.GetHabbo().GetInventoryComponent().GetPets()));
}
else
room1.GetRoomUserManager().RemoveBot(this.GetHabbo().animal.VirtualId, false);
if (!client.GetHabbo().GetInventoryComponent().TryGetPet(this.GetHabbo().animal.PetId, out Pet1))
{
client.SendWhisper("Cant get pet from ur inventory", 0);
return;
}
if (Pet1 == null)
return;
int X = 3;
int Y = 14;
Room room2 = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(80);
RoomUser Pet2 = (RoomUser)null;
if (room2.GetRoomUserManager().TryGetPet(Pet1.PetId, out Pet2))
room2.GetRoomUserManager().RemoveBot(Pet2.VirtualId, false);
Pet1.X = X;
Pet1.Y = Y;
Pet1.PlacedInRoom = true;
Pet1.RoomId = room2.RoomId;
List<RandomSpeech> Speeches = new List<RandomSpeech>();
RoomBot Bot = new RoomBot(Pet1.PetId, Pet1.RoomId, "pet", "freeroam", Pet1.Name, "", Pet1.Look, X, Y, 0.0, 0, 0, 0, 0, 0, ref Speeches, "", 0, Pet1.OwnerId, false, 0, false, 0);
if (Bot == null)
return;
room2.GetRoomUserManager().DeployBot(Bot, Pet1);
Pet1.DBState = DatabaseUpdateState.NeedsUpdate;
room2.GetRoomUserManager().UpdatePets();
client.SendMessage((IServerPacket)new PetInventoryComposer(client.GetHabbo().GetInventoryComponent().GetPets()));
}
RoomUser User = this.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.GetHabbo().Id);
if (User.isHacking || User.isHelpingHack || (User.hasStoleFromAtm || User.volerAtm))
{
The passage with the appartid for all animals :
if (Pet1 == null)
return;
int X = 3;
int Y = 14;
Room room2 = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(80);
RoomUser Pet2 = (RoomUser)null;
if (room2.GetRoomUserManager().TryGetPet(Pet1.PetId, out Pet2))
room2.GetRoomUserManager().RemoveBot(Pet2.VirtualId, false);
Pet1.X = X;
Pet1.Y = Y;
Pet1.PlacedInRoom = true;
Pet1.RoomId = room2.RoomId;
List<RandomSpeech> Speeches = new List<RandomSpeech>();
RoomBot Bot = new RoomBot(Pet1.PetId, Pet1.RoomId, "pet", "freeroam", Pet1.Name, "", Pet1.Look, X, Y, 0.0, 0, 0, 0, 0, 0, ref Speeches, "", 0, Pet1.OwnerId, false, 0, false, 0);
if (Bot == null)
return;
room2.GetRoomUserManager().DeployBot(Bot, Pet1);
Pet1.DBState = DatabaseUpdateState.NeedsUpdate;
room2.GetRoomUserManager().UpdatePets();
client.SendMessage((IServerPacket)new PetInventoryComposer(client.GetHabbo().GetInventoryComponent().GetPets()));
}
RoomUser User = this.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(this.GetHabbo().Id);
if (User.isHacking || User.isHelpingHack || (User.hasStoleFromAtm || User.volerAtm))
{

Problem 2 :
I added new purchasable clothes in my catalogue. They work but when i put this code in my figuredata :
set id="4130" gender="U" club="0" colorable="1" selectable="1" preselectable="0" >
All users have the clothes who appear in the wardrobe editor.. No need to buy it so .. :(
When i put this code :
<set id="4130" gender="U" club="0" colorable="1" selectable="0" preselectable="1" sellable="1">
The clothe doesn't appear in the wardrobe editor (yeeah), but the clothes is invisible too and it doesn't save in the database + it's impossible to modify the color while the user bought it.., and when the user disconnect, he lost the clothe if he doesn't save his look :(

Thanks to the people who will help me <3_<3
Post automatically merged:

i've tried this code in my figuredata :
<set id="4130" gender="U" club="0" colorable="1" selectable="1" preselectable="0" sellable="1">
Ok the clothe is added to the wardrobe editor, i can change the color but .. the clothing doesn't save in the user_clothing table
 
Last edited:

Users who are viewing this thread

Top