public override bool OnUse(GameClient session, string[] args) { RoomUnitUser me = session.GetHabbo().GetRoomSession().GetRoomUser(); if (me.Riding is RoomPet pet) { pet.Rider = null; me.Riding = null; me.StopMoving(); me.UpdateState(); me.ApplyEffect(0); me.Session.GetHabbo().GetUserStats().Equestrian = 0; } return(true); }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null && session.GetHabbo().GetRoomSession() != null) { RoomUnitUser user = session.GetHabbo().GetRoomSession().CurrentRoomRoomUser; if (user != null) { if (user.Riding != null) { int x = message.PopWiredInt32(); int y = message.PopWiredInt32(); user.Riding.MoveTo(x, y); } else { if ((user.RestrictMovementType & RestrictMovementType.Client) == 0) { int x = message.PopWiredInt32(); int y = message.PopWiredInt32(); if (user.X != x || user.Y != y) { if (user.Teleport) { user.StopMoving(); user.SetLocation(x, y, user.Z); } else { user.MoveTo(x, y); } } } } } } }
public override bool OnUse(GameClient session, string[] args) { if (args.Length >= 2) { RoomPet pet = session.GetHabbo().GetRoomSession().GetRoom().RoomUserManager.GetPetByName(args[1]); if (pet != null) { if (pet.Rider == null) { if (pet.PetData.Type == 13) { RoomUnitUser me = session.GetHabbo().GetRoomSession().GetRoomUser(); bool doit = true; if ((me.X + 1 != pet.X || me.Y != pet.Y) && (me.X - 1 != pet.X || me.Y != pet.Y) && (me.Y + 1 != pet.Y || me.X != pet.X)) { bool skip = false; if (me.X - 1 == pet.X) { if (me.Y == pet.Y) { skip = true; } } if (!skip) { doit = me.X == pet.X || me.Y == pet.Y; } } if (doit) { pet.Rider = me; me.Riding = pet; me.StopMoving(); me.SetLocation(pet.X, pet.Y, pet.Z + 1); me.ApplyEffect(77); session.SendNotif("If you want get off use command :getoff"); GameClient owner = Skylight.GetGame().GetGameClientManager().GetGameClientById(pet.PetData.OwnerID); if (owner != null) { owner.GetHabbo().GetUserStats().StableOwner++; owner.GetHabbo().GetUserAchievements().CheckAchievement("StableOwner"); } else { using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("ownerId", pet.PetData.OwnerID); dbClient.ExecuteQuery("UPDATE user_stats SET stable_owner = stable_owner + 1 WHERE user-id = @ownerId LIMIT 1"); } } me.Session.GetHabbo().GetUserStats().Equestrian = 0; } else { session.SendNotif("Ah.. you try to access the horse from long range"); } } else { session.SendNotif("You blind or something m8? You can clearly see that pet is not a horse!"); } } else { session.SendNotif("I think someone is riding that horse already..."); } return(true); } } return(false); }